Files
pgMultiMaster/database.py
T
george 7a0e8c7cd6 feat:
--FastAPI Table added
	--CHECK register_node
2026-09-08 17:11:20 +05:30

25 lines
455 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, declarative_base
DATABASE_URL = "postgresql://postgres:postgres@172.16.10.178:5444/postgres"
engine = create_engine(
DATABASE_URL,
pool_pre_ping=True
)
SessionLocal = sessionmaker(
autocommit=False,
autoflush=False,
bind=engine
)
Base = declarative_base()
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()