Fix SQL expression warning in health check endpoint
This commit is contained in:
parent
c31f672ed7
commit
56e04ce623
@ -1,5 +1,6 @@
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy import text
|
||||
from app.db.session import get_db
|
||||
|
||||
router = APIRouter()
|
||||
@ -19,8 +20,8 @@ def health_check(db: Session = Depends(get_db)):
|
||||
|
||||
# Test database connection
|
||||
try:
|
||||
# Execute a simple query
|
||||
db.execute("SELECT 1")
|
||||
# Execute a simple query using proper SQLAlchemy text() function
|
||||
db.execute(text("SELECT 1"))
|
||||
except Exception as e:
|
||||
health_status["status"] = "unhealthy"
|
||||
health_status["database"] = f"down: {str(e)}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user