Fix database health check by adding commit after query execution
This commit is contained in:
parent
6705b7a5e2
commit
652f32404a
@ -1,5 +1,6 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy import text
|
||||
from datetime import datetime
|
||||
|
||||
from app.db.session import get_db
|
||||
@ -13,7 +14,8 @@ def health_check(db: Session = Depends(get_db)):
|
||||
"""
|
||||
try:
|
||||
# Check database connection
|
||||
db.execute("SELECT 1")
|
||||
db.execute(text("SELECT 1"))
|
||||
db.commit()
|
||||
db_status = "healthy"
|
||||
except Exception as e:
|
||||
db_status = f"unhealthy: {str(e)}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user