Database Config¶
database_config ¶
Database Configuration - Path Management.
Provides configuration management for database file paths and connection settings for all four databases.
Classes:
| Name | Description |
|---|---|
DatabaseConfig | Database configuration manager for file paths and settings |
Classes¶
DatabaseConfig ¶
Database configuration manager.
Manages paths and settings for all four databases: BioRemPP, KEGG, HADEG, and ToxCSM.
Attributes:
| Name | Type | Description |
|---|---|---|
config_file | Path | Path to database config YAML file |
_config | Dict[str, Dict[str, str]] | Loaded database configurations |
Methods:
| Name | Description |
|---|---|
get_database_path | Get database file path |
get_database_encoding | Get database file encoding |
get_database_separator | Get database CSV separator |
get_all_database_paths | Get all database paths |
validate_paths | Validate that all database files exist |
get_database_info | Get complete database configuration |
get_available_databases | Get list of available database names |
Initialize database configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_file | Optional[Path] | Path to database config YAML file. Defaults to 'config/databases.yaml'. | None |
Source code in src/infrastructure/config/database_config.py
Functions¶
get_database_path ¶
Get database file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_name | str | Database name ('biorempp', 'kegg', 'hadeg', 'toxcsm') | required |
Returns:
| Type | Description |
|---|---|
Path | Path to database file |
Raises:
| Type | Description |
|---|---|
ValueError | If database name is unknown |
Source code in src/infrastructure/config/database_config.py
get_database_encoding ¶
Get database file encoding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_name | str | Database name. | required |
default | str | Default encoding if not specified. | 'utf-8' |
Returns:
| Type | Description |
|---|---|
str | File encoding. |
Source code in src/infrastructure/config/database_config.py
get_database_separator ¶
Get database CSV separator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_name | str | Database name. | required |
default | str | Default separator if not specified. | ';' |
Returns:
| Type | Description |
|---|---|
str | CSV separator. |
Source code in src/infrastructure/config/database_config.py
get_all_database_paths ¶
Get all database paths.
Returns:
| Type | Description |
|---|---|
Dict[str, Path] | Dictionary mapping database names to paths |
Source code in src/infrastructure/config/database_config.py
validate_paths ¶
Validate that all database files exist.
Returns:
| Type | Description |
|---|---|
Dict[str, bool] | Dictionary mapping database names to existence status |
Source code in src/infrastructure/config/database_config.py
get_database_info ¶
Get complete database configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database_name | str | Database name. | required |
Returns:
| Type | Description |
|---|---|
Dict[str, str] | Database configuration dictionary. |
Raises:
| Type | Description |
|---|---|
ValueError | If database name is unknown. |
Source code in src/infrastructure/config/database_config.py
get_available_databases ¶
Get list of available database names.
Returns:
| Type | Description |
|---|---|
list[str] | List of database names. |