From 98d9fc64d98ffe5e5bee90378d12ad68054073f6 Mon Sep 17 00:00:00 2001 From: yuriy Date: Thu, 11 Jan 2024 01:42:34 +0100 Subject: [PATCH] rebase --- cosmos/config.py | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/cosmos/config.py b/cosmos/config.py index 014a77208..46e3f1915 100644 --- a/cosmos/config.py +++ b/cosmos/config.py @@ -212,8 +212,6 @@ class ProfileConfig: :param target_name: The name of the dbt target to use. :param profiles_yml_filepath: The path to a profiles.yml file to use. :param profile_mapping: A mapping of Airflow connections to dbt profiles. - :param dbt_config_vars: Dictionary of dbt configs for the project. This argument overrides configs defined in your profiles.yml - file. The dictionary is dumped to a yaml string. Details https://docs.getdbt.com/docs/core/connect-data-platform/profiles.yml """ # should always be set to be explicit @@ -225,11 +223,9 @@ class ProfileConfig: # should be set if using cosmos to map Airflow connections to dbt profiles profile_mapping: BaseProfileMapping | None = None - dbt_config_vars: dict[str, Any] | None = None def __post_init__(self) -> None: self.validate_profile() - self.validate_dbt_config_vars() def validate_profile(self) -> None: "Validates that we have enough information to render a profile." @@ -240,42 +236,6 @@ def validate_profile(self) -> None: "Both profiles_yml_filepath and profile_mapping are defined and are mutually exclusive. Ensure only one of these is defined." ) - def validate_dbt_config_vars(self) -> None: - "Validates config vars for profile." - - vars_checks: dict[str, dict[str, Any]] = { - "send_anonymous_usage_stats": {"var_type": bool}, - "use_colors": {"var_type": bool}, - "partial_parse": {"var_type": bool}, - "printer_width": {"var_type": int}, - "write_json": {"var_type": bool}, - "warn_error": {"var_type": str}, - "log_format": {"var_type": str, "accepted_values": {"text", "json", "default"}}, - "debug": {"var_type": bool}, - "version_check": {"var_type": bool}, - "fail_fast": {"var_type": bool}, - "use_experimental_parser": {"var_type": bool}, - "static_parser": {"var_type": bool}, - } - - if self.dbt_config_vars: - for var_key, var_value in self.dbt_config_vars.items(): - vars_check = vars_checks.get(var_key) - if vars_check: - var_type = vars_check.get("var_type") - if var_type: - if not isinstance(var_value, var_type): - raise CosmosValueError(f"dbt config var {var_key}: {var_value} must be a {var_type}") - - accepted_values = vars_check.get("accepted_values") - if accepted_values: - if var_value not in accepted_values: - raise CosmosValueError( - f"dbt config var {var_key}: {var_value} must be one of {accepted_values}" - ) - else: - warnings.warn(f"dbt config var {var_key}: {var_value} is not supported") - def validate_profiles_yml(self) -> None: "Validates a user-supplied profiles.yml is present" if self.profiles_yml_filepath and not Path(self.profiles_yml_filepath).exists(): @@ -292,10 +252,7 @@ def ensure_profile( elif self.profile_mapping: profile_contents = self.profile_mapping.get_profile_file_contents( - profile_name=self.profile_name, - target_name=self.target_name, - use_mock_values=use_mock_values, - dbt_config_vars=self.dbt_config_vars, + profile_name=self.profile_name, target_name=self.target_name, use_mock_values=use_mock_values ) if use_mock_values: