11 lines
362 B
Python
11 lines
362 B
Python
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker
|
|
from app.core.config import settings
|
|
|
|
engine = create_async_engine(settings.database_url, echo=settings.debug)
|
|
AsyncSessionLocal = async_sessionmaker(engine, expire_on_commit=False)
|
|
|
|
|
|
async def get_db():
|
|
async with AsyncSessionLocal() as session:
|
|
yield session
|