Area: Ingestion
Sub-Area: Transformers
Applies to: OSS + Cloud
Issue
You use a domain transformer in an ingestion recipe to assign domains by pattern. After ingestion, the domains you expect are missing, or domains you set on DataHub earlier are gone.
You Might Be Asking
- Why does my recipe fail or assign no domains?
- How do I keep domains that someone already set in DataHub?
- Does
replace_existing: falsekeep existing domains? - Which transformer should I use?
Cause
Several things can cause this:
-
Default semantics are OVERWRITE. Without
semantics: PATCH, the transformer writes the domains it computed and does not read the domains already on the server. Anything set earlier, for example in the UI, is replaced. -
replace_existingis not the fix. It defaults tofalse. It only decides whether domains sent by the ingestion source are kept (false) or dropped (true). It does not turn on debug logging, and it does not keep domains stored on DataHub. -
Each rule value must be a list. The
rulesfield is a map of regex to a list of domains. A bare string value fails config validation. -
Rule keys are matched with
re.match. That anchors the key at the start of the string, so a key such asprod_db\..*does not match text that appears later in the string. Start the key with.*to match anywhere. - Regex keys need single quotes. Write them in single quotes, as the DataHub docs do.
-
transformersis in the wrong place. It must be a top-level key next tosourceandsink. Undersource.configit is rejected as an unknown field. -
Domain values are resolved in two ways. A value that starts with
urn:li:domain, or that looks like a UUID, is used as is and is never checked against the server. If the URN is wrong, for example the wrong case, assets are attached to a domain that does not exist, and no error appears. A plain name or id is looked up on the server, first asurn:li:domain:<value>and then by display name. If it is not found, the run fails with:domain <value> doesn't seem to be provisioned on DataHub. Either provision it first and re-run ingestion, or provide a fully qualified domain id (e.g. urn:li:domain:ec428203-ce86-4db3-985d-5a8ee6df32ba) to skip this check. -
No server connection. If a plain name needs lookup and the recipe has no server connection, the run fails with
Following domains need server-side resolution [...] but a DataHub server wasn't provided.Use fully qualified domain URNs, or add adatahub_apiconfig to the recipe. -
You use a deprecated transformer.
pattern_add_dataset_domainstill works, but it is a dataset-only wrapper and raises a deprecation warning. Usepattern_add_domain.
Solution
- Switch to
pattern_add_domain, puttransformersat the top level, use single-quoted keys, and make each value a list. Setsemantics: PATCHto merge with the domains already on DataHub:
source:
type: <your source>
config:
# your source settings
transformers:
- type: "pattern_add_domain"
config:
semantics: PATCH
domain_pattern:
rules:
'.*\.finance\..*':
- "urn:li:domain:finance"
'.*\.marketing\..*':
- "urn:li:domain:marketing"
'.*prod_db\..*':
- "urn:li:domain:production"
sink:
type: datahub-rest
config:
# your sink settings
With semantics: PATCH, the transformer merges its domains with the server's domains. See the transformer docs.
-
Check each domain value. Copy the URN of each domain from DataHub exactly. In Cloud, domains are under Govern > Domains in the sidebar. A fully qualified URN is not verified, so a typo does not cause an error.
-
If a run fails with "doesn't seem to be provisioned", create the domain first, or use its fully qualified URN. For the create API, see the Domain API tutorial.
-
Test your regex keys with a Python regex tester using
re.match. Run the recipe against a small source first and check the domains in the UI.
Related Documentation
- Pattern Add Domain transformer
- Dataset transformers, including the replace_existing and semantics relationship
- Domains
- Domain API tutorial
Tags: domains, transformers, metadata, troubleshooting