From 52a4fe2625b63683fcdcd74f704e49aa65cb0dd8 Mon Sep 17 00:00:00 2001 From: Luiz Gustavo Monteiro Date: Sun, 26 Oct 2025 16:09:12 -0300 Subject: database connection tested successfully - tables readed on pgadmin --- mqtt_client/database.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'mqtt_client/database.py') diff --git a/mqtt_client/database.py b/mqtt_client/database.py index e69de29..c0691a1 100644 --- a/mqtt_client/database.py +++ 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() -- cgit v1.2.3