This commit is contained in:
2024-03-19 09:01:46 +03:00
parent aafa1050a7
commit 6ba041a839
23 changed files with 369 additions and 39 deletions

View File

@@ -1,3 +1,5 @@
from typing import AsyncGenerator
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.orm import sessionmaker
@@ -10,10 +12,10 @@ session_maker = sessionmaker(
class_=AsyncSession,
expire_on_commit=False,
autocommit=False,
autoflush=False
autoflush=False,
)
async def get_session() -> AsyncSession:
async def get_session() -> AsyncGenerator[AsyncSession, None]:
async with session_maker() as session:
yield session