websauna.system.model.meta module¶
Database default base models and session setup.
-
class
websauna.system.model.meta.
Base
(**kwargs)¶ Bases:
object
The most base type
-
metadata
= MetaData(bind=None)¶
-
-
websauna.system.model.meta.
create_dbsession
(registry, manager=None, *, isolation_level=<object object>)[source]¶ Creates a new database using the configured session pooling.
This is called outside request life cycle when initializing and checking the state of the databases.
-
websauna.system.model.meta.
create_transaction_manager_aware_dbsession
(request)[source]¶ Defaut database factory for Websauna.
Looks up database settings from the INI and creates an SQLALchemy session based on the configuration. The session is terminated on the HTTP request finalizer.
- Return type
-
websauna.system.model.meta.
get_default_engine
(registry)[source]¶ Creates or gets the default database engine using the settings in registry.
The engine is a singleton and a reference will be stored in the application registry. :type registry:
Registry
:param registry: the registry :rtype:Engine
:return: the created engine
-
websauna.system.model.meta.
get_engine
(settings, prefix='sqlalchemy.')[source]¶ Reads config and create a database engine out of it.