You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If path=None, it has no searched_path / relative_path. If I change that to
Reproduction case
# dbt_project.ymlvars:
one_var: fooone_var: bar
$ dbt parse
17:20:39 Encountered an error:
'NoneType' object has no attribute 'searched_path'
If I change the code linked above to:
exceptdbt.exceptions.DuplicateYamlKeyExceptionase:
# TODO: We may want to raise an exception instead of a warning in the future. ifpath:
e.msg=f"{e}{path.searched_path}/{path.relative_path}."dbt.exceptions.warn_or_raise(e, log_fmt=warning_tag("{}"))
$ dbt parse
17:21:36 [WARNING]: Compilation Error
Duplicate 'one_var' key found in yaml file
17:21:36 Encountered an error while reading the project:
17:21:36 ERROR: Runtime Error
dbt_project.yml does not parse to a dictionary
17:21:36 Encountered an error:
Runtime Error
Could not run dbt
This is still a problem. This parses successfully in v1.1. We MUST make this a warning, not an error.
We can do that by using SafeLoader instead of UniqueKeyLoader, and still returning the loaded result (if not --warn-error):
exceptdbt.exceptions.DuplicateYamlKeyExceptionase:
ifpath:
# TODO: We may want to raise an exception instead of a warning in the future.e.msg=f"{e}{path.searched_path}/{path.relative_path}."dbt.exceptions.warn_or_raise(e, log_fmt=warning_tag("{}"))
returnyaml.load(contents, Loader=SafeLoader)
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
DuplicateYamlKeyException needs to be warning, not (broken) exception
[CT-722] DuplicateYamlKeyException needs to be warning, not (broken) exception
Jun 3, 2022
Net-new bug in v1.2. See also #5268, which I believe is caused by the same root change (#5146).
dbt-core/core/dbt/clients/yaml_helper.py
Lines 75 to 88 in eea872c
If
path=None
, it has nosearched_path
/relative_path
. If I change that toReproduction case
If I change the code linked above to:
This is still a problem. This parses successfully in v1.1. We MUST make this a warning, not an error.
We can do that by using
SafeLoader
instead ofUniqueKeyLoader
, and still returning the loaded result (if not--warn-error
):The text was updated successfully, but these errors were encountered: