dwh_auditor.config — 設定ファイルの読み込みと DWH 設定管理

dwh_auditor.config モジュールは、config.yaml を読み込み Pydantic モデルとして型安全に管理します。 外部から取得した設定値は即座にバリデーションされるため、 不正な値(負のコスト単価など)は起動時に検出されます。

詳細な設定値の説明は 設定ファイル (config.yaml) — コスト単価・しきい値の DWH 監査設定 を参照してください。


設定ファイル (config.yaml) の読み込みとパース.

class dwh_auditor.config.PricingConfig(*, tb_scan_usd=6.25)[ソース]

ベースクラス: BaseModel

コスト計算の単価設定.

パラメータ:

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)[ソース]

ベースクラス: BaseModel

警告しきい値の設定.

パラメータ:
  • 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')[ソース]

ベースクラス: BaseModel

dbt 連携設定 (将来拡張用).

パラメータ:
  • 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>)[ソース]

ベースクラス: BaseModel

設定ファイル全体のスキーマ.

パラメータ:
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)[ソース]

YAML 設定ファイルを読み込み AppConfig に変換して返す.

パラメータ:

path (str) -- 設定ファイルのパス (例: "config.yaml")

戻り値:

パース済みの AppConfig オブジェクト

例外:
  • FileNotFoundError -- 指定されたパスにファイルが存在しない場合

  • yaml.YAMLError -- YAML のパースに失敗した場合

  • pydantic.ValidationError -- 設定値がスキーマに合致しない場合

戻り値の型:

AppConfig