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