Area: Ingestion Issues
Sub-Area: dbt Source Configuration
Applies to: OSS + Cloud
Issue
Lineage between your dbt models and your BigQuery tables is missing. Your BigQuery tables have uppercase characters in their names. The dbt source and the BigQuery source build different URNs for the same table, so DataHub can't link them. You may also see two datasets in the catalog that differ only in casing.
You Might Be Asking
- Why is lineage missing between my dbt models and BigQuery tables?
- Why do I see duplicate datasets that differ only in casing?
- How do I fix URN casing between dbt and BigQuery?
- How do I remove the extra lowercase datasets?
- What happens if I change
convert_urns_to_lowercaseafter I have already ingested data?
Cause
URN casing is part of each dataset's identity. The two sources have different defaults:
- The BigQuery source keeps the original identifier casing. Its
convert_urns_to_lowercasedefaults to false. - The dbt source lowercases dataset URNs. Its
convert_urns_to_lowercasedefaults to true.
For a table named MyDb.MyTable, BigQuery writes MyDb.MyTable. dbt builds the warehouse URN as mydb.mytable and writes its sibling link and lineage to that URN. DataHub creates a sibling-only stub dataset for the lowercase URN. The real table has no dbt link, and the catalog shows two datasets that differ only in casing. The dbt model is attached to the stub.
Solution
-
Use a CLI that supports the fix. Use acryl-datahub 1.6.0 or later, or upgrade to the latest release. On DataHub Cloud, open Admin > Data Sources, edit the dbt source, and check the advanced "CLI Version" field. If it pins an older version, clear it or raise it. See UI ingestion.
-
Add
convert_urns_to_lowercase: falseto your dbt recipe:
source:
type: dbt
config:
convert_urns_to_lowercase: false
# ... rest of your existing configuration
-
Make sure
target_platform,target_platform_instanceandenvin the dbt recipe match the BigQuery recipe. URNs only match when all of these agree, along with the casing. Both ingestions are needed. They can run in any order. -
Re-run dbt ingestion.
-
Check that lineage now connects dbt models to BigQuery tables.
-
Remove the leftover lowercase BigQuery stub datasets. The dataset page menu has no Delete option, so use the CLI. dbt stateful ingestion does not remove these stubs, because dbt's writes on warehouse URNs are not tracked for stale removal.
For each stub, check that its URN is the lowercase one and not your real table. Then run:
datahub delete --urn "<urn>"This is a soft delete by default. To undo it, run:
datahub delete undo-by-filter --urn "<urn>"See deleting metadata.
Before you change this setting
The setting applies to every dataset URN the dbt recipe emits, on any platform. It is not limited to BigQuery. Changing it re-keys every dataset in that recipe. For example, MyDb.MyTable becomes mydb.mytable, or the reverse.
With stateful ingestion enabled on the dbt source, the old-cased dbt URNs are soft-deleted as stale and new-cased ones are created. The warehouse stubs described in step 6 are not removed this way.
Pick one value and keep it. Don't toggle it between runs.
Related Documentation
- dbt source configuration
- BigQuery source configuration
- UI ingestion (CLI Version setting)
- Deleting metadata
Tags: dbt, bigquery, lineage, urn, case-sensitivity, convert_urns_to_lowercase, ingestion, configuration