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 76a3980e26a..e3463d1fc57 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 b6211ddfbc6..af5cba8f2fc 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}"))