API to test Db connection
This commit is contained in:
parent
128279c619
commit
6cd950b6aa
12
main.py
12
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"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user