chapps.dbsession module

SQLAlchemy DB session global setup

This module’s purpose is to present a simple and unencumbered module to include in order to access the database according to the configured credentials.

chapps.dbsession.DIALECT_MAP = {'mariadb': 'mysql', 'mysql': 'mysql'}

Map dialects to drivers, for DBI URL construction

chapps.dbsession.create_db_url(cfg=None)[source]

Create a DBI URL for initializing SQLAlchemy

Parameters

cfg (Optional[CHAPPSConfig]) – optional config override

Return type

URL

Returns

URL instance for use in accessing the database

chapps.dbsession.sql_engine = Engine(mysql://chapps:***@localhost:3306/chapps)

a package-global SQL engine