chore: refactor
This commit is contained in:
parent
87107d8c31
commit
d319a1c5e0
|
|
@ -1,21 +0,0 @@
|
|||
# src/dataloader/storage/db.py
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import AsyncIterator
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
|
||||
async def session_scope() -> AsyncIterator[AsyncSession]:
|
||||
"""
|
||||
Асинхронный контекст жизненного цикла сессии.
|
||||
Получает sessionmaker из AppContext.
|
||||
|
||||
Yields:
|
||||
AsyncSession для работы с БД
|
||||
"""
|
||||
from dataloader.context import APP_CTX
|
||||
|
||||
sm = APP_CTX.sessionmaker
|
||||
async with sm() as s:
|
||||
yield s
|
||||
Loading…
Reference in New Issue