simple-rag / app /core /database.py
vara201's picture
Simple rag V1
5b570cf
Raw History Blame Contribute Delete
432 Bytes
from sqlalchemy.ext.asyncio import (
create_async_engine,
async_sessionmaker,
AsyncSession,
)
from app.core.config import settings
engine = create_async_engine(
settings.DATABASE_URL,
echo=False,
)
AsyncSessionLocal = async_sessionmaker(
engine,
expire_on_commit=False,
)
async def get_db() -> AsyncSession:
async with AsyncSessionLocal() as session:
yield session