Correct stop of loop, mysql and influx

This commit is contained in:
marys
2025-09-26 11:43:40 +02:00
parent 521c474a17
commit cf5b486b2a
2 changed files with 6 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
from typing import AsyncGenerator
from sqlalchemy.ext.asyncio import (create_async_engine, AsyncSession,
async_sessionmaker, AsyncEngine)
@@ -44,7 +46,8 @@ def get_mysql_engine() -> AsyncEngine:
def get_mysql_session_local() -> AsyncSession:
return mysql_SessionLocal()
async def get_mysql_db():
async def get_mysql_db() -> AsyncGenerator[AsyncSession]:
"""FastAPI dependency for providing DB sessions"""
async with get_mysql_session_local() as session:
yield session
print(f"{session=}")
yield session