mirror of
https://github.com/rommapp/romm.git
synced 2026-02-01 19:24:50 +08:00
As recommended by SQLAlchemy [1], this change makes a single instantiation of the database engine and session maker, instead of one entity per handler. It also uses the provided `URL` constructor to better define the database URL structure. [1] https://docs.sqlalchemy.org/en/20/core/connections.html#basic-usage
10 lines
302 B
Python
10 lines
302 B
Python
from config.config_manager import ConfigManager
|
|
from sqlalchemy import create_engine
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
sync_engine = create_engine(ConfigManager.get_db_engine(), pool_pre_ping=True)
|
|
sync_session = sessionmaker(bind=sync_engine, expire_on_commit=False)
|
|
|
|
|
|
class DBBaseHandler: ...
|