Spaces:
Sleeping
Sleeping
Download app/core/database.py from vara201/simple-rag: direct link, hf CLI and curl.
- Browser
- Download file 432 Bytes
-
https://huggingface.co/spaces/vara201/simple-rag/resolve/main/app/core/database.py
- Command line
-
hf download hf://spaces/vara201/simple-rag/app/core/database.py
-
curl -L -o database.py https://huggingface.co/spaces/vara201/simple-rag/resolve/main/app/core/database.py
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 |