from __future__ import annotations from dataclasses import dataclass from ingestion.common.env import require_env from ingestion.common.load_config import LoadConfigBase, TableTargets, load_config_file # Re-exported so importers (and tests) can use ``from ...config import TableTargets``. __all__ = ["LoadConfig", "TableTargets", "load_load_config"] @dataclass(frozen=True) class LoadConfig(LoadConfigBase): """GCS bulk-load source: the storage-agnostic base plus the GCS read credential. The base supplies the Cloud Lake DSN, target databases, source-contract resolution, and (for external sources) the storage-agnostic `external` accessors. This subclass adds only how Cloud Lake reads GCS: a base64 service-account key Databend uses for the gcs:// stage. """ @property def gcs_credential_env(self) -> str: return self.data.get("gcs", {}).get("credential_env", "GCS_CREDENTIAL") @property def gcs_credential(self) -> str: return require_env(self.gcs_credential_env) @property def gcs_credential_env_names(self) -> list[str]: return [self.gcs_credential_env] def load_load_config(path) -> LoadConfig: return load_config_file(path, LoadConfig)