mirror of
https://github.com/Rhinemann/IoT-Systems.git
synced 2026-03-14 20:50:39 +02:00
16 lines
476 B
Python
16 lines
476 B
Python
|
|
from sqlalchemy import MetaData
|
||
|
|
from sqlalchemy import create_engine
|
||
|
|
from sqlalchemy.orm import sessionmaker, declarative_base
|
||
|
|
|
||
|
|
from config import POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DB
|
||
|
|
|
||
|
|
|
||
|
|
DATABASE_URL = f"postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@{POSTGRES_HOST}:{POSTGRES_PORT}/{POSTGRES_DB}"
|
||
|
|
engine = create_engine(DATABASE_URL)
|
||
|
|
|
||
|
|
Base = declarative_base()
|
||
|
|
|
||
|
|
metadata = MetaData()
|
||
|
|
|
||
|
|
SessionLocal = sessionmaker(bind=engine)
|