Spaces:
Sleeping
Sleeping
Praveen-K-0503 commited on
Commit ·
fb85f93
1
Parent(s): f4ccc6d
feat: setup postgresql connection via DATABASE_URL
Browse files- database.py +5 -1
- requirements.txt +1 -0
database.py
CHANGED
|
@@ -8,7 +8,11 @@ class FlightReport(SQLModel, table=True):
|
|
| 8 |
duration_frames: int
|
| 9 |
chaos_anomalies: int
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
def init_db():
|
| 14 |
SQLModel.metadata.create_all(engine)
|
|
|
|
| 8 |
duration_frames: int
|
| 9 |
chaos_anomalies: int
|
| 10 |
|
| 11 |
+
import os
|
| 12 |
+
|
| 13 |
+
DATABASE_URL = os.environ.get("DATABASE_URL", "sqlite:///crowd_data.db")
|
| 14 |
+
|
| 15 |
+
engine = create_engine(DATABASE_URL)
|
| 16 |
|
| 17 |
def init_db():
|
| 18 |
SQLModel.metadata.create_all(engine)
|
requirements.txt
CHANGED
|
@@ -20,6 +20,7 @@ scikit-learn
|
|
| 20 |
|
| 21 |
# ── Database ORM ─────────────────────────────────────────────────
|
| 22 |
sqlmodel
|
|
|
|
| 23 |
|
| 24 |
# ── Misc utilities ───────────────────────────────────────────────
|
| 25 |
easydict
|
|
|
|
| 20 |
|
| 21 |
# ── Database ORM ─────────────────────────────────────────────────
|
| 22 |
sqlmodel
|
| 23 |
+
psycopg2-binary
|
| 24 |
|
| 25 |
# ── Misc utilities ───────────────────────────────────────────────
|
| 26 |
easydict
|