"""Async SQLAlchemy engine/session wiring.""" from collections.abc import AsyncGenerator from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine from app.core.config import get_settings settings = get_settings() engine = create_async_engine(settings.database_url, pool_pre_ping=True) AsyncSessionLocal = async_sessionmaker(bind=engine, expire_on_commit=False, autoflush=False) async def get_db() -> AsyncGenerator[AsyncSession, None]: async with AsyncSessionLocal() as session: yield session