Fix SQL expression in health endpoint using text() function
This commit is contained in:
parent
7e1ce84c0a
commit
8e7df05614
@ -1,5 +1,6 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy import text
|
||||
from datetime import datetime
|
||||
|
||||
from app.database import get_db
|
||||
@ -15,7 +16,7 @@ def health_check(db: Session = Depends(get_db)):
|
||||
# Test database connection
|
||||
try:
|
||||
# Just execute a simple query
|
||||
db.execute("SELECT 1")
|
||||
db.execute(text("SELECT 1"))
|
||||
db_status = "healthy"
|
||||
except Exception as e:
|
||||
db_status = f"unhealthy: {str(e)}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user