Spaces:
Runtime error
Runtime error
Download backend/app/database.py from Varun10000/rfprfprfprfprfprfp: direct link, hf CLI and curl.
- Browser
- Download file 428 Bytes
-
https://huggingface.co/spaces/Varun10000/rfprfprfprfprfprfp/resolve/main/backend/app/database.py
- Command line
-
hf download hf://spaces/Varun10000/rfprfprfprfprfprfp/backend/app/database.py
-
curl -L -o database.py https://huggingface.co/spaces/Varun10000/rfprfprfprfprfprfp/resolve/main/backend/app/database.py
428 Bytes
| from sqlalchemy import create_engine | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import sessionmaker | |
| from app.config import settings | |
| engine = create_engine(settings.DATABASE_URL) | |
| SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | |
| Base = declarative_base() | |
| def get_db(): | |
| db = SessionLocal() | |
| try: | |
| yield db | |
| finally: | |
| db.close() | |