Download database.py from moriire/OpenGenAI: direct link, hf CLI and curl.
- Browser
- Download file 476 Bytes
-
https://huggingface.co/spaces/moriire/OpenGenAI/resolve/f96821c8bcd909ea24382d3532f80bcfd68898de/database.py
- Command line
-
hf download hf://spaces/moriire/OpenGenAI@f96821c8bcd909ea24382d3532f80bcfd68898de/database.py
-
curl -L -o database.py https://huggingface.co/spaces/moriire/OpenGenAI/resolve/f96821c8bcd909ea24382d3532f80bcfd68898de/database.py
476 Bytes
| from sqlalchemy import create_engine | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from sqlalchemy.orm import sessionmaker | |
| SQLALCHEMY_DATABASE_URL = "sqlite://" # "sqlite:////./sql_app.db" | |
| # SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db" | |
| engine = create_engine( | |
| SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} | |
| ) | |
| SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | |
| Base = declarative_base() | |