From e1a9d9f94f0eb1b6e6efd0d3bc5b0f17b0786a76 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:15:52 -0400 Subject: [PATCH] Readd exp_path for config deprecation warnings (#7536) (#7737) (cherry picked from commit 9c7e01dbcac5c3a5071deb5e72250c25b646e835) Co-authored-by: Jeremy Cohen Co-authored-by: Michelle Ark --- .changes/unreleased/Fixes-20230506-180900.yaml | 6 ++++++ core/dbt/config/project.py | 8 ++++---- core/dbt/events/types.py | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .changes/unreleased/Fixes-20230506-180900.yaml diff --git a/.changes/unreleased/Fixes-20230506-180900.yaml b/.changes/unreleased/Fixes-20230506-180900.yaml new file mode 100644 index 00000000000..b7159138625 --- /dev/null +++ b/.changes/unreleased/Fixes-20230506-180900.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix warning messages for deprecated dbt_project.yml configs +time: 2023-05-06T18:09:00.361961+02:00 +custom: + Author: jtcohen6 + Issue: "7424" diff --git a/core/dbt/config/project.py b/core/dbt/config/project.py index 96705c7ccb0..f3723e41eb7 100644 --- a/core/dbt/config/project.py +++ b/core/dbt/config/project.py @@ -315,10 +315,10 @@ def check_config_path( # this field is no longer supported, but many projects may specify it with the default value # if so, let's only raise this deprecation warning if they set a custom value if not default_value or project_dict[deprecated_path] != default_value: - deprecations.warn( - f"project-config-{deprecated_path}", - deprecated_path=deprecated_path, - ) + kwargs = {"deprecated_path": deprecated_path} + if expected_path: + kwargs.update({"exp_path": expected_path}) + deprecations.warn(f"project-config-{deprecated_path}", **kwargs) def create_project(self, rendered: RenderComponents) -> "Project": unrendered = RenderComponents( diff --git a/core/dbt/events/types.py b/core/dbt/events/types.py index 135c422e4c6..dab9ec31b18 100644 --- a/core/dbt/events/types.py +++ b/core/dbt/events/types.py @@ -280,7 +280,7 @@ def code(self): def message(self): description = ( - f"The `{self.deprecated_path}` config has been renamed to `{self.exp_path}`." + f"The `{self.deprecated_path}` config has been renamed to `{self.exp_path}`. " "Please update your `dbt_project.yml` configuration to reflect this change." ) return line_wrap_message(warning_tag(f"Deprecated functionality\n\n{description}")) @@ -292,7 +292,7 @@ def code(self): def message(self): description = ( - f"The `{self.deprecated_path}` config has been renamed to `{self.exp_path}`." + f"The `{self.deprecated_path}` config has been renamed to `{self.exp_path}`. " "Please update your `dbt_project.yml` configuration to reflect this change." ) return line_wrap_message(warning_tag(f"Deprecated functionality\n\n{description}"))