When I ingest data using Dagster and then connect ...
# ask-ai
g
When I ingest data using Dagster and then connect that asset with dbt, I use the
meta
-Key in the dbt source. If I add a test to that source without using the source in a dbt model the test failes with
relation xyz does not exist
. How can I fix that? I'd like to run the tests even though I'm not yet using the source in any model.
s
Based on the documentation, when integrating dbt with Dagster, you can define dbt sources as Dagster assets and specify the corresponding Dagster asset key in the
meta
property within your
sources.yml
file. This allows Dagster to understand the relationship between dbt sources and Dagster assets, and it can infer dependencies for any dbt model that relies on this dbt source. However, if you're encountering an issue where a dbt test fails with a
relation xyz does not exist
error, it suggests that dbt is trying to run a test on a source that it expects to exist in the database, but it does not. This could happen if the source table has not been created or is not available in the expected schema or database. To address this issue, you should ensure that the source data is actually present in the database and that the dbt source configuration in
sources.yml
correctly reflects the location of the source data. Additionally, you should verify that the database and schema names are correctly specified and that any necessary permissions are in place to access the data. If you want to run dbt tests on sources without using them in any models, you still need to make sure that the sources are properly defined and that the underlying data they refer to is present in the database. Dbt tests will attempt to query the database for these sources, so they must exist for the tests to pass. The documentation does not explicitly cover the scenario where dbt tests fail due to missing relations when sources are not used in models. If the issue persists after verifying the source data and configuration, you may want to consult the dbt documentation or seek support from the dbt community for more dbt-specific guidance on running tests independently of models.