mafw.db.db_connection
Database connection configuration helpers.
- Author:
Bulgheroni Antonio
- Description:
Normalize database steering configuration into peewee connection arguments.
Module Attributes
Supported authentication methods for |
|
Keys reserved by the legacy DBConfiguration schema. |
Functions
|
Normalize DBConfiguration mappings into peewee connection arguments. |
- mafw.db.db_connection.build_connection_parameters(config: Mapping[str, Any]) tuple[str, dict[str, Any]][source]
Normalize DBConfiguration mappings into peewee connection arguments.
The input can either be the full steering configuration dictionary or the nested
DBConfigurationtable. The returned tuple provides the URL and the keyword arguments forpeewee.connect.- Parameters:
config (Mapping[str, Any]) – Steering configuration or DBConfiguration table.
- Returns:
Tuple with database URL and connection keyword arguments.
- Return type:
tuple[str, dict[str, Any]]
- Raises:
ValueError – When required fields are missing or invalid.
- mafw.db.db_connection.LEGACY_KEYS: set[str] = {'URL', 'pragmas'}
Keys reserved by the legacy DBConfiguration schema.
- mafw.db.db_connection.VALID_AUTH_METHODS: set[str] = {'env', 'file', 'inline'}
Supported authentication methods for
DBConfiguration.authentication.