diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-10-28 21:08:46 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-10-28 21:08:46 -0300 |
| commit | b4187a0c9a5eb2542c40918481698d02d3cbd099 (patch) | |
| tree | 8f3ff397dd3d9603d0590e5725d8d2f5386dbbcd /api/database.py | |
| parent | 0c5b080efac82b1d196e3dde00e5950c97ecbb68 (diff) | |
| parent | ba527291e59f1c4cc28b68e4fe119c44a95ab3f6 (diff) | |
Merge branch 'master' of github.com:Simplesmente-O-Grupo/iot-monitoring
Diffstat (limited to 'api/database.py')
| -rw-r--r-- | api/database.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/api/database.py b/api/database.py new file mode 100644 index 0000000..c0691a1 --- /dev/null +++ b/api/database.py @@ -0,0 +1,10 @@ +from sqlalchemy import create_engine +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker +import os + +DATABASE_URL = os.getenv("DATABASE_URL", "postgresql://root:public@postgres:5432/control_station") + +engine = create_engine(DATABASE_URL) +SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) +Base = declarative_base() |
