From c0cfc4ba9f92ca0f3dd36f19defa3cdfb9c33619 Mon Sep 17 00:00:00 2001 From: canglan Date: Wed, 1 Apr 2026 16:37:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=A5=E5=BA=B7=E7=9B=91?= =?UTF-8?q?=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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",