dwh_auditor.config — Load configuration files and manage DWH settings

The dwh_auditor.config module reads config.yaml and manages it type-safely as a Pydantic model. Configuration values ​​obtained from external sources are immediately validated, so invalid values ​​(such as negative unit costs) are detected at startup.

See Configuration File (config.yaml) for detailed configuration value descriptions.


Load and parse configuration file (config.yaml).

class dwh_auditor.config.PricingConfig(*, tb_scan_usd=6.25)[source]

Bases: BaseModel

Unit price setting for cost calculation.

Parameters:

tb_scan_usd (float)

tb_scan_usd: float
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class dwh_auditor.config.ThresholdsConfig(*, ignore_full_scan_under_gb=1.0, top_expensive_queries_limit=10, zombie_table_days=90, full_scan_ratio_threshold=0.9)[source]

Bases: BaseModel

Setting warning thresholds.

Parameters:
  • ignore_full_scan_under_gb (float)

  • top_expensive_queries_limit (int)

  • zombie_table_days (int)

  • full_scan_ratio_threshold (float)

ignore_full_scan_under_gb: float
top_expensive_queries_limit: int
zombie_table_days: int
full_scan_ratio_threshold: float
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class dwh_auditor.config.DbtConfig(*, enabled=False, job_label_key='dbt_model')[source]

Bases: BaseModel

dbt linkage settings (for future expansion).

Parameters:
  • enabled (bool)

  • job_label_key (str)

enabled: bool
job_label_key: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class dwh_auditor.config.AppConfig(*, pricing=<factory>, thresholds=<factory>, dbt=<factory>)[source]

Bases: BaseModel

Schema of the entire configuration file.

Parameters:
pricing: PricingConfig
thresholds: ThresholdsConfig
dbt: DbtConfig
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

dwh_auditor.config.load_config(path)[source]

Reads a YAML configuration file, converts it to AppConfig, and returns it.

Parameters:

path (str) – Configuration file path (e.g. “config.yaml”)

Returns:

Parsed AppConfig object

Raises:
  • FileNotFoundError – If the file does not exist at the specified path

  • yaml.YAMLError – If YAML parsing fails

  • pydantic.ValidationError – If the settings do not match the schema

Return type:

AppConfig