Spaces:
Sleeping
Sleeping
Download src/core/database.py from ibad363/todo-backend: direct link, hf CLI and curl.
- Browser
- Download file 301 Bytes
-
https://huggingface.co/spaces/ibad363/todo-backend/resolve/main/src/core/database.py
- Command line
-
hf download hf://spaces/ibad363/todo-backend/src/core/database.py
-
curl -L -o database.py https://huggingface.co/spaces/ibad363/todo-backend/resolve/main/src/core/database.py
301 Bytes
| from sqlmodel import create_engine, Session, SQLModel | |
| from .config import settings | |
| engine = create_engine( | |
| settings.DATABASE_URL, | |
| pool_pre_ping=True, | |
| pool_recycle=3600 | |
| ) | |
| def init_db(): | |
| # This will be used to create tables if they don't exist | |
| SQLModel.metadata.create_all(engine) | |