diff --git a/backend/main.py b/backend/main.py index 2e24c00..c0ffe8f 100644 --- a/backend/main.py +++ b/backend/main.py @@ -25,6 +25,7 @@ from .routers.v1 import ( auth_router, user_router, todos_router, notes_router, tools_router, stats_router ) +from sqlalchemy import text @asynccontextmanager @@ -90,7 +91,8 @@ app.middleware("http")(log_requests) @app.get("/health") async def health_check(db: Session = Depends(get_db)): try: - db.execute("SELECT 1") + # 使用 text() 包裹 SQL 语句 + db.execute(text("SELECT 1")) return { "status": "healthy", "database": "connected",