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
I have built a dbt model (say model_a) which targets a database _analysis and depends on source table source_b in the database _raw. The model builds fine so I know that the model's not buggy but the unit test fails with the following error:
Compilation Error in model source_b (models/source.yml)
Not able to get columns for unit test 'source_b' from relation "_raw"."public"."source_b"
> in macro get_fixture_sql (macros/unit_test_sql/get_fixture_sql.sql)
> called by model source_b (models/source.yml)
Hi @kd-nishanth - moved this conversation over to a new issue as I don't think this is related to the ephemeral model problem. The direct parents of the model that you’re unit testing (in your example, anything model_a depends on - source_b and model_c) need to exist in the warehouse before you can execute the unit test, because we need to know what field names and data types to use when constructing the unit test sql.
Given that:
your source_b does exist on the database and is dbt profile is able to read from it
the unit test works if you swap out source_b with a table materialized model of source_b in the unit test and the model for model_a
this is quite perplexing!
Could you do two things:
check if you're able to run dbt docs generate for source_b
send an example of what your source yml definition looks like for source_b
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.
I have built a dbt model (say
model_a
) which targets a database_analysis
and depends on source tablesource_b
in the database_raw
. The model builds fine so I know that the model's not buggy but the unit test fails with the following error:Additional Information:
source_b
"_raw"."public"."source_b"
does exist on the database and is dbt profile is able to read from it (because the model get's built)source_b
with atable
materialized model ofsource_b
in the unit test and the model formodel_a
.I'm happy to share more and/or contribute to resolving this ticket.
Originally posted by @kd-nishanth in #9686 (comment)
The text was updated successfully, but these errors were encountered: