dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.57k stars 1.59k forks source link

[Bug] Saved queries break the data lineage in dbt docs #10419

Open siljamardla opened 1 month ago

siljamardla commented 1 month ago

Is this a new bug in dbt-core?

Current Behavior

Hey folks :wave: Since upgrading to dbt 1.7 we have the issue with missing lineage in dbt docs. In the Chrome dev tools console we see the following message:

index.html:73 TypeError: Cannot read properties of undefined (reading 'resource_type')

I've started debugging, and in the screenshot, you can see the piece of code where it fails while building the lineage graph. When traversing the parents map, it's trying to get the resource info about a saved query from the manifest in the nodes property. Saved queries info is not there, lookup returns undefined, and whole thing fails due to referencing property of undefined. Did this issue pop up already? A known bug?

image

Expected Behavior

One can add saved queries to a dbt project and instead of breaking the docs, the saved queries show up in the docs.

Steps To Reproduce

  1. Create saved query in your project
  2. Generate dbt docs
  3. View the lineage - there is nothing (no models, sources, metrics, absolutely nothing)
  4. Remove the saved query
  5. Generate dbt docs
  6. View the lineage - all of your lineage is back

Relevant log output

No response

Environment

- OS:
- Python:
- dbt: 1.7

Which database adapter are you using with dbt?

spark

Additional Context

Slack thread

dbeatty10 commented 1 month ago

Thanks for reporting this @siljamardla !

This looks like the same thing as https://github.com/dbt-labs/dbt-docs/issues/486 to me.

Could you try upgrading to v1.8 and see if that resolves the issue for you or not?