summaryrefslogtreecommitdiff
path: root/mqtt_client/database.py
diff options
context:
space:
mode:
authorGustavoeklund01 <eklundgu@gmail.com>2025-10-27 19:16:14 -0300
committerGustavoeklund01 <eklundgu@gmail.com>2025-10-27 19:16:14 -0300
commitbe7952f3585fe895a3309a19e14cd93f89c3ce1b (patch)
treea5fc0ee9f964273879abcd6a17b96ac44eec9941 /mqtt_client/database.py
parent4008253dfd2005da102f6da06389268ecef152f6 (diff)
parent52a4fe2625b63683fcdcd74f704e49aa65cb0dd8 (diff)
Merge branch 'master' of https://github.com/Simplesmente-O-Grupo/iot-monitoring
Diffstat (limited to 'mqtt_client/database.py')
-rw-r--r--mqtt_client/database.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/mqtt_client/database.py b/mqtt_client/database.py
new file mode 100644
index 0000000..c0691a1
--- /dev/null
+++ b/mqtt_client/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()