"""Database session and engine setup.""" from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine, async_sessionmaker from sqlalchemy.orm import DeclarativeBase from app.config import DATABASE_URL engine = create_async_engine(DATABASE_URL, echo=False, pool_size=10, max_overflow=5) async_session = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit=False) class Base(DeclarativeBase): pass async def get_db() -> AsyncSession: async with async_session() as session: yield session