From 6cd950b6aae9256acb22e76dfea68f49f80ca38c Mon Sep 17 00:00:00 2001 From: gourav Date: Sun, 9 Aug 2026 07:50:01 +0530 Subject: [PATCH] API to test Db connection --- main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/main.py b/main.py index 28aee3c..34aaee6 100644 --- a/main.py +++ b/main.py @@ -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"""