Download app/core/database.py from Seth0330/keeai: direct link, hf CLI and curl.
- Browser
- Download file 517 Bytes
-
https://huggingface.co/spaces/Seth0330/keeai/resolve/main/app/core/database.py
- Command line
-
hf download hf://spaces/Seth0330/keeai/app/core/database.py
-
curl -L -o database.py https://huggingface.co/spaces/Seth0330/keeai/resolve/main/app/core/database.py
517 Bytes
| from sqlalchemy import create_engine | |
| from sqlalchemy.orm import sessionmaker, declarative_base | |
| from .config import settings | |
| # If DATABASE_URL starts with sqlite, we need a special argument | |
| connect_args = {} | |
| if settings.DATABASE_URL.startswith("sqlite"): | |
| connect_args = {"check_same_thread": False} | |
| engine = create_engine( | |
| settings.DATABASE_URL, | |
| connect_args=connect_args, | |
| pool_pre_ping=True, | |
| ) | |
| SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | |
| Base = declarative_base() | |