High severitydbt
Power BI Refresh Error:
Database Error: relation does not exist
What does this error mean?
dbt attempted to query or reference a table or view that does not exist in the target database.
Common causes
- 1An upstream dbt model failed to build, so the table it creates does not exist when a downstream model tries to reference it
- 2A source table defined in a sources.yml file was deleted, renamed, or moved to a different schema
- 3The dbt project is targeting the wrong schema or database (e.g., development schema instead of production)
- 4A model references a table using a raw SQL string instead of the ref() or source() functions, hardcoding a schema that doesn't exist
- 5The relation was built in a previous run but was dropped by a DDL change or database cleanup
How to fix it
- 1Run `dbt ls` to see which models are configured, then run the failing model with `--select` and `--upstream` flags to build dependencies first.
- 2Check the dbt job run log for earlier failures — find the upstream model that failed to create the missing table.
- 3Verify that the source table exists in the database: run `SELECT * FROM <schema>.<table> LIMIT 1` in your SQL client.
- 4Ensure all model references use `{{ ref('model_name') }}` and all source references use `{{ source('source_name', 'table_name') }}` — never hardcode schema names.
- 5Confirm the dbt profile (profiles.yml) is targeting the correct environment and schema.
- 6If the table was dropped, rerun the full DAG from the root source to recreate all relations in order.
Frequently asked questions
Official documentation: dbt-docs