ksyasuda af0d958b89
All checks were successful
Build Docker Image / build (push) Successful in 12m54s
update code structure and get session on each query
2025-02-09 20:20:10 -08:00

15 lines
346 B
Python

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from app.config import Config
engine = create_engine(Config.DATABASE_URL, pool_pre_ping=True)
Session = scoped_session(sessionmaker(bind=engine))
def get_db_session():
return Session()
def close_db_session(exception=None):
Session.remove()