Area: Ingestion Issues
Sub-Area: dbt Transformers / Structured Properties
Applies to: OSS + Cloud
Issue
You add the tags_to_structured_properties transformer to a dbt or dbt Cloud ingestion recipe. The run finishes, and the tags show on your datasets, but the structured properties stay empty. Column-level tags from column_meta_mapping never turn into structured properties.
You Might Be Asking
- Why are my dbt tags visible in DataHub but no structured properties are created?
- Do I need to turn off stateful ingestion and run a full re-ingestion so the transformer sees my tags?
- Why does the transformer ignore my column-level tags?
- How do I set structured properties on dbt models and columns directly from
meta? - How do I give a structured property more than one value from dbt?
Cause
Stateful ingestion is not the cause. For dbt, stateful ingestion only soft deletes entities that were in the last run but are missing from the current one. It never skips unchanged entities. Every dbt run emits the globalTags aspect for each model, and the transformer processes it on every run. Turning off stateful ingestion changes nothing for the transformer. See Stateful Ingestion.
The transformer produces no structured properties for one of these reasons:
- The structured property does not exist in DataHub. The transformer only assigns values. It does not create property definitions, and DataHub does not store values for a property that has no definition.
- The tags are not in
key:valueform. Key-value parsing is off by default (process_key_value_tags: false). Tags without the separator, and without a match intag_structured_property_map, are skipped with the warningdoes not match any configured property mapping. - The dbt
tag_prefixchanges the key. Its default isdbt:, so ameta_mappingtagtier:goldarrives asdbt:tier:gold. The transformer splits on the first:, so the property key becomesdbtand the value becomestier:gold. - The value breaks the property definition. A value outside the property's allowed values, or more than one value on a single-value property, is rejected.
- The tags are column-level tags. The dbt source puts column tags inside the dataset's
schemaMetadataaspect. It does not emit a separateglobalTagsaspect per column, so the transformer never sees them.
Solution
For dbt, the direct fix is the add_structured_property operation in meta_mapping and column_meta_mapping. It sets structured properties straight from dbt meta, at model and column level, with no tag step. If you want to keep the transformer, follow the checks in the second part.
Option 1: Use add_structured_property (recommended for dbt)
- Create each structured property in DataHub first. See Create and Add a Structured Property. Pick a "List" type if a property needs more than one value.
- Upgrade the DataHub CLI to the latest release. For UI ingestion, set the CLI version of the source to the latest release.
- Add the operation to your recipe.
structured_property_urnis required. It takes a full URN or the property's qualified name. The operation is described under dbt meta automated mappings.
source:
type: dbt-cloud
config:
account_id: 123456
project_id: 234567
job_id: 345678
token: "${DBT_CLOUD_TOKEN}"
target_platform: bigquery
meta_mapping:
tier:
match: ".*"
operation: add_structured_property
config:
structured_property_urn: "urn:li:structuredProperty:tier"
column_meta_mapping:
classification:
match: ".*"
operation: add_structured_property
config:
structured_property_urn: "urn:li:structuredProperty:data.classification"
- Run the ingestion. You don't need to change
stateful_ingestion.
At column level, the operation writes a structuredProperties aspect on each matching column (schemaField) URN.
Option 2: Fix the tags_to_structured_properties setup
- Create every target property in DataHub first. The property ID is
key_value_property_prefixplus the tag key. With an empty prefix, the tagtier:goldneeds a property with the qualified nametier. - Set
tag_prefix: ""in the dbt source config so the tag key is yourmetakey and notdbt. - Set
process_key_value_tags: truein the transformer config, or list your keyword tags intag_structured_property_map. - Put
transformersat the top level of the recipe, next tosource, not insidesource.config.
source:
type: dbt-cloud
config:
account_id: 123456
project_id: 234567
job_id: 345678
token: "${DBT_CLOUD_TOKEN}"
target_platform: bigquery
tag_prefix: ""
meta_mapping:
tier:
match: ".*"
operation: add_tag
config:
tag: "tier:{{ $match }}"
transformers:
- type: "tags_to_structured_properties"
config:
process_key_value_tags: true
key_value_separator: ":"
key_value_property_prefix: ""
remove_original_tags: false
- Run with debug logging to see what the transformer does for each dataset:
datahub --debug ingest -c your-dbt-recipe.yaml
--debug goes before ingest. It is an option of the top-level datahub command. The debug log shows a line per dataset with how many tags became structured properties.
Things to know about this path:
- With the default
write_semantics: PATCH, the dbt source merges the tags already on the dbt dataset in DataHub into the tags it emits. Those tags go through the transformer too. If you changetag_prefixfromdbt:to"", the olddbt:tier:goldtags stay and map to a property nameddbt. Remove the old prefixed tags from those datasets. - The transformer ignores its
semanticssetting. It writes the wholestructuredPropertiesaspect, so it replaces structured property values that were set another way on the same dataset, such as in the UI.add_structured_propertydoes the same. Use one method per property and don't edit those properties by hand. - Column-level tags don't work with the transformer (cause 5). Use
add_structured_propertyincolumn_meta_mappingfor columns.
Multi-Value Fields in dbt meta
If a structured property takes more than one value, give the values as a YAML list in your dbt schema.yml. A comma-separated string becomes one value.
models:
- name: your_model_name
config:
meta:
appid:
- APP00001
- APP00002
With add_structured_property, the list becomes two values on the property. With add_tag and the transformer, the latest CLI makes one tag per list item, and the transformer gathers them into one property with two values. Older CLI versions join the list items into a single tag. In both cases, the property must use a "List" type. DataHub rejects more than one value on a single-value property.
Related Documentation
- Dataset Transformers: Tags to Structured Properties
- dbt Ingestion Source: dbt meta automated mappings
- Create and Add a Structured Property
- Transformers Introduction
- Stateful Ingestion
Tags: dbt, tags-to-structured-properties, transformer, structured-properties, meta-mapping, column-meta-mapping, add-structured-property, tag-prefix, dbt-cloud