Correct stop of loop, mysql and influx
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user