fix: use await engine.connect() instead of async with

SQLAlchemy 2.0 async engine.connect() doesn't support context manager.
Use explicit connect/close instead.
This commit is contained in:
Fusion
2026-05-18 22:38:08 +02:00
parent 9fefe289a7
commit 285d3dace8
+4 -1
View File
@@ -44,8 +44,11 @@ async def init_database(
try:
# Test basic connectivity
from sqlalchemy import text
async with engine.connect() as conn:
conn = await engine.connect()
try:
await conn.execute(text("SELECT 1"))
finally:
await conn.close()
logger.info("Database connection established.")