Spaces:
Sleeping
Sleeping
Download database/db.py from DarkLofi/construtech-api: direct link, hf CLI and curl.
- Browser
- Download file 493 Bytes
-
https://huggingface.co/spaces/DarkLofi/construtech-api/resolve/main/database/db.py
- Command line
-
hf download hf://spaces/DarkLofi/construtech-api/database/db.py
-
curl -L -o db.py https://huggingface.co/spaces/DarkLofi/construtech-api/resolve/main/database/db.py
493 Bytes
| from sqlalchemy import create_engine | |
| from sqlalchemy.orm import sessionmaker | |
| from database.models import Base | |
| SQLALCHEMY_DATABASE_URL = "sqlite:///./barueltech.db" | |
| engine = create_engine( | |
| SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} | |
| ) | |
| SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | |
| def init_db(): | |
| Base.metadata.create_all(bind=engine) | |
| if __name__ == "__main__": | |
| init_db() | |
| print("Banco de dados inicializado com sucesso!") | |