Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: properties command fails when dbt issues warning #12

Closed
ciklista opened this issue Dec 8, 2021 · 1 comment · Fixed by #15
Closed

Bug: properties command fails when dbt issues warning #12

ciklista opened this issue Dec 8, 2021 · 1 comment · Fixed by #15
Assignees

Comments

@ciklista
Copy link
Contributor

ciklista commented Dec 8, 2021

Problem:

dbt-invoke properties raises json.decoder.JSONDecodeError: Extra data: line 1 column 2 (char 1) when dbt ls --output json issues a warning like

08:04:21  [WARNING]: Deprecated functionality
The `source-paths` config has been renamed to `model-paths`. Please update your
`dbt_project.yml` configuration to reflect this change.
{"resource_type": "model", "depends_on": {"macros": [], ...
...

The issue is in the parsing of the dbt ls parsing (https://github.com/Dashlane/dbt-invoke/blob/main/dbt_invoke/internal/_utils.py#L171) which will fail if not all the output is valid json.

I assume that this might not be the only place where dbt json output is being parsed but I haven't had the time to investigate further yet. I think dbt will raise the warning on most (if not all) dbt commands.

Proposed solution
Imho I think that warnings should be passed onto the output of dbt-invoke properties but should not cause the command to fail.

@ciklista ciklista mentioned this issue Dec 8, 2021
@robastel robastel self-assigned this Dec 23, 2021
@robastel
Copy link
Member

I plan on taking a further look into this and potentially working on a solution in the coming days.

@robastel robastel linked a pull request Jan 1, 2022 that will close this issue
robastel added a commit that referenced this issue Jan 3, 2022
* Handle warnings from dbt ls commands

Signed-off-by: Robert Astel <rob.astel@gmail.com>

* Reformat with Black

Signed-off-by: Robert Astel <rob.astel@gmail.com>

* Make json default for dbt ls, do not rerun dbt ls unnecessarily

Signed-off-by: Robert Astel <rob.astel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants