mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
14 lines
550 B
Python
14 lines
550 B
Python
from sqlalchemy import create_engine
|
|
from backend.app.config import get_settings
|
|
|
|
connection_string = "postgresql+{drivername}://{username}:{password}@{server}:{port}/{dbname}"
|
|
db_string = connection_string.format(
|
|
drivername="psycopg2", # You'll need to use psycopg2 driver for PostgreSQL
|
|
username=get_settings().DB_USERNAME,
|
|
password=get_settings().DB_PASSWORD,
|
|
server=get_settings().DB_HOST,
|
|
port=get_settings().DB_PORT,
|
|
dbname=get_settings().DB_NAME,
|
|
)
|
|
|
|
db_engine = create_engine(db_string, pool_size=20, max_overflow=5)
|