Download app/db/init_db.py from Housable/LangChain: direct link, hf CLI and curl.
- Browser
- Download file 622 Bytes
-
https://huggingface.co/spaces/Housable/LangChain/resolve/main/app/db/init_db.py
- Command line
-
hf download hf://spaces/Housable/LangChain/app/db/init_db.py
-
curl -L -o init_db.py https://huggingface.co/spaces/Housable/LangChain/resolve/main/app/db/init_db.py
622 Bytes
| from sqlalchemy.orm import Session | |
| from app import crud, schemas | |
| from app.core.config import settings | |
| from app.db import base # noqa: F401 | |
| # make sure all SQL Alchemy models are imported (app.db.base) before initializing DB | |
| # otherwise, SQL Alchemy might fail to initialize relationships properly | |
| # for more details: https://github.com/tiangolo/full-stack-fastapi-postgresql/issues/28 | |
| def init_db(db: Session) -> None: | |
| # Tables should be created with Alembic migrations | |
| # But if you don't want to use migrations, create | |
| # the tables un-commenting the next line | |
| # Base.metadata.create_all(bind=engine) | |