Download backend/app/core/database.py from hengds2f/agentic: direct link, hf CLI and curl.
- Browser
- Download file 450 Bytes
-
https://huggingface.co/spaces/hengds2f/agentic/resolve/main/backend/app/core/database.py
- Command line
-
hf download hf://spaces/hengds2f/agentic/backend/app/core/database.py
-
curl -L -o database.py https://huggingface.co/spaces/hengds2f/agentic/resolve/main/backend/app/core/database.py
450 Bytes
| from __future__ import annotations | |
| from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine | |
| from app.core.config import settings | |
| engine = create_async_engine(settings.database_url, echo=settings.debug) | |
| async_session = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit=False) | |
| async def get_db() -> AsyncSession: # type: ignore[misc] | |
| async with async_session() as session: | |
| yield session | |