API to test Db connection

This commit is contained in:
Gourav Kumar 2026-08-09 07:50:01 +05:30
parent 128279c619
commit 6cd950b6aa

12
main.py
View File

@ -59,6 +59,18 @@ async def upload(file: UploadFile):
return {"status": "success"}
@app.get('/test-db', dependencies=[Depends(authenticate)])
async def test_db():
conn = connect_db()
try:
with conn.cursor() as cur:
cur.execute("select 1")
cur.fetchall()
return "If you're reading this, you're ready to update NAVs"
except Exception as e:
return "No bueno" + e
@app.post("/update-nav", dependencies=[Depends(authenticate)])
async def update_nav(data: list[dict]):
"""Upsert the NAV data into the nav_history table"""