From 56e04ce6235d20e36194de5a3fd092ee443bfa1d Mon Sep 17 00:00:00 2001 From: Automated Action Date: Tue, 3 Jun 2025 14:24:32 +0000 Subject: [PATCH] Fix SQL expression warning in health check endpoint --- app/api/routes/health.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/api/routes/health.py b/app/api/routes/health.py index 7cfb04b..1f55078 100644 --- a/app/api/routes/health.py +++ b/app/api/routes/health.py @@ -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)}"