MetricSign
EN|NLRequest Access
Medium severitycompilation

Power BI Refresh Error:
DbtReferenceError (cross-database)

What does this error mean?

A dbt model references another model in a different database using ref(), but the adapter or warehouse does not support cross-database queries, or the cross-database reference is not configured correctly in dbt_project.yml.

Common causes

  • 1A ref() call attempts to reference a model in a different database than the current target, which is not supported on all adapters
  • 2The database property in the model's config block does not match the actual target database for the environment
  • 3A dbt project with multiple databases uses ref() across database boundaries without enabling cross-database macros
  • 4The referenced model does not exist in the specified database — it was built in a different environment or not yet run
  • 5A dbt mesh (multi-project) setup references a model from another project but the cross-project ref is not configured

How to fix it

  1. 1Check adapter support for cross-database refs: Snowflake, BigQuery (cross-dataset), and Databricks Unity Catalog support them; Redshift and Postgres do not.
  2. 2Use the full three-part identifier in the ref config: {{ ref('other_db', 'schema', 'model') }} for Snowflake.
  3. 3For dbt mesh, configure the producer project to expose the model with access: public in the YAML and add the project dependency in packages.yml.
  4. 4Verify the referenced model has been materialized in the target database by running dbt ls --select <project>.<model>.
  5. 5Use a source() definition instead of ref() if the cross-database model is managed by a different team and not part of the same dbt project.

Frequently asked questions

Does Snowflake support cross-database ref() in dbt?

Yes. Snowflake supports three-part identifiers (database.schema.object), so cross-database refs work natively. Ensure the dbt runner role has SELECT on the source database.

What is the difference between cross-database ref() and dbt mesh cross-project ref()?

Cross-database ref() resolves a model in a different database within the same dbt project. dbt mesh cross-project ref() resolves a model defined in a separate dbt project and requires the producer project to expose the model as public.

Other compilation errors