Coverage for src / mafw / db / db_configurations.py: 100%
5 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-12 09:03 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-12 09:03 +0000
1# Copyright 2025–2026 European Union
2# Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
3# SPDX-License-Identifier: EUPL-1.2
4"""
5Module provides default configurations for different database engines.
6"""
8from typing import Any
10#: default configuration dictionary used to generate steering files
11default_conf: dict[str, dict[str, Any]] = {
12 'sqlite': {
13 'URL': 'sqlite:///my_database.db',
14 'parameters': {
15 'sqlite': {
16 'pragmas': {'journal_mode': 'wal', 'cache_size': -64000, 'foreign_keys': 1, 'synchronous': 0},
17 }
18 },
19 },
20 'postgresql': {
21 'URL': 'postgresql://postgres:my_password@localhost:5432/my_database',
22 'authentication': {
23 'method': 'env',
24 'username': 'POSTGRES_USER',
25 'password': 'POSTGRES_PASS',
26 },
27 'parameters': {'postgresql': {}},
28 },
29 'mysql': {
30 'URL': 'mysql://user:passwd@ip:port/my_db',
31 'authentication': {
32 'method': 'env',
33 'username': 'MYSQL_USER',
34 'password': 'MYSQL_PASS',
35 },
36 'parameters': {'mysql': {}},
37 },
38}
40#: default database scheme
41db_scheme = {
42 'sqlite': 'sqlite:///',
43 'postgresql': 'postgresql://',
44 'mysql': 'mysql://',
45}
47DEFAULT_SQLITE_PRAGMAS = default_conf['sqlite']['parameters']['sqlite']['pragmas']
48"""Default pragma settings for SQLite connections."""