-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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] Lineage Graph Ignore Sources Declared From graph.sources.values()
#10665
Comments
Thanks for reporting this @ghilman27 ! So are you saying it looks like this: But you expect it to look like this? |
The green rectangle of And yes, I expect it to look like the one you pointed out |
Here's the key insight:
So what you are reporting is actually the behavior we expect, and I'm going to close this as "not planned". More detaildbt has a couple main phases it goes through before running any SQL: parsing and compilation. 1. Parsing: During parsing, it builds a DAG of nodes (like sources, models, etc). The result is the manifest. It gives the 2. Compilation: Then dbt can use that manifest to fill in the fully qualified table names when compiling a model. ExampleYou can see more tangibly why all those source nodes are available when you compile but not for the graph visualization if you compile the model code included below. It prints out the value of the You'll actually see that dbt runs your code not once, but TWICE -- one time when Toggle to see model code
{{ log("execute: " ~ execute, True) }}
{{ log("Num sources: " ~ graph.sources | length, True) }}
{# WITH graph.sources #}
{%- set graph_tables = [] -%}
{%- set graph_tables = ["api_masked_10002", "api_masked_10005"] -%}
{%- for node in graph.sources.values() -%}
{% if node.name in graph_tables %}
{%- do log("SELECT * FROM " ~ source('load', node.name), True) %}
SELECT * FROM {{ source('load', node.name) }}
{%- do log("UNION ALL", True) %}
UNION ALL
{% endif %}
{%- endfor -%}
{# Using ordinary variables #}
{% set ordinary_tables = ['api_masked_1746', 'api_masked_2892'] %}
{% for ordinary_table in ordinary_tables %}
{%- do log("SELECT * FROM " ~ source('load', ordinary_table), True) %}
SELECT * FROM {{ source('load', ordinary_table) }}
{% if not loop.last %}
{%- do log("UNION ALL", True) %}
UNION ALL
{% endif %}
{% endfor %} dbt compile -s models/model_10665.sql --no-partial-parse DocumentationWe have a couple call-outs already about this here and here, but we'd be open to feedback if you think there's other ways we can enhance the documentation to explain that the |
@dbeatty10 I see! I had a bad feeling that it might have a connection with the Red Heads up :( My bad 🙏! To be honest, I didn't notice the A nice improvement would be to show my example here, either within the |
[Preview](https://docs-getdbt-com-git-dbeatty10-patch-1-dbt-labs.vercel.app/reference/dbt-jinja-functions/execute) ## What are you changing in this pull request and why? Noticed a couple places where we could add links while responding to dbt-labs/dbt-core#10665. ## Checklist - [x] I have reviewed the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines. --------- Co-authored-by: Mirna Wong <[email protected]>
Totally understandable! Thanks for your suggestions for improving the documentation 🤩. I've included them in dbt-labs/docs.getdbt.com#6027. |
Is this a new bug in dbt-core?
Current Behavior
GIVEN THAT my sources.yml
And my model definition looks like this
I then got the compiled query like this
But the lineage graph only shows
api_masked_1746
andapi_masked_2892
.api_masked_10002
andapi_masked_10005
are ignoredExpected Behavior
See all sources including
api_masked_10002
andapi_masked_10005
on Lineage GraphSteps To Reproduce
put the same config as mine using the same environment, then you are set
Relevant log output
Environment
meltano/meltano:v3.4.2-python3.10
. The full version output ofdbt --version
python --version
inside the docker: 3.10.14Which database adapter are you using with dbt?
bigquery
Additional Context
I haven't tried using the ordinary dbt (not the meltano dockerized version one). I'll update if I have time to check that.
The text was updated successfully, but these errors were encountered: