MetricSign
EN|NLRequest Access
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

  1. 1Run `dbt ls` to see which models are configured, then run the failing model with `--select` and `--upstream` flags to build dependencies first.
  2. 2Check the dbt job run log for earlier failures — find the upstream model that failed to create the missing table.
  3. 3Verify that the source table exists in the database: run `SELECT * FROM <schema>.<table> LIMIT 1` in your SQL client.
  4. 4Ensure all model references use `{{ ref('model_name') }}` and all source references use `{{ source('source_name', 'table_name') }}` — never hardcode schema names.
  5. 5Confirm the dbt profile (profiles.yml) is targeting the correct environment and schema.
  6. 6If the table was dropped, rerun the full DAG from the root source to recreate all relations in order.

Frequently asked questions

Why does this error appear in production but not in development?

Development and production often target different schemas. If a model was only run in development, the production schema won't have the table yet. Run the full dbt job in production to materialize all models.

How do I find which upstream model created the missing table?

Run `dbt docs generate && dbt docs serve` to open the lineage DAG. Find the failing model and trace its upstream dependencies to identify which model should have created the missing relation.

Official documentation: dbt-docs

Other dbt errors