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
- 1Check adapter support for cross-database refs: Snowflake, BigQuery (cross-dataset), and Databricks Unity Catalog support them; Redshift and Postgres do not.
- 2Use the full three-part identifier in the ref config: {{ ref('other_db', 'schema', 'model') }} for Snowflake.
- 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.
- 4Verify the referenced model has been materialized in the target database by running dbt ls --select <project>.<model>.
- 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.