summaryrefslogtreecommitdiff
path: root/mqtt_client/database.py
diff options
context:
space:
mode:
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()