Spaces:
Sleeping
Sleeping
Download app/db/database.py from sandy898/resonate-api: direct link, hf CLI and curl.
- Browser
- Download file 443 Bytes
-
https://huggingface.co/spaces/sandy898/resonate-api/resolve/main/app/db/database.py
- Command line
-
hf download hf://spaces/sandy898/resonate-api/app/db/database.py
-
curl -L -o database.py https://huggingface.co/spaces/sandy898/resonate-api/resolve/main/app/db/database.py
443 Bytes
| from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker, AsyncSession | |
| from sqlalchemy.orm import declarative_base | |
| from app.core.config import settings | |
| engine = create_async_engine(settings.DATABASE_URL, echo=False) | |
| AsyncSessionLocal = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit=False) | |
| Base = declarative_base() | |
| async def get_db(): | |
| async with AsyncSessionLocal() as session: | |
| yield session | |