Area: Product
Sub-Area: Governance
Applies to: OSS + Cloud
Issue
Domains are not applying correctly to assets, or assets end up in the wrong domain. Common causes are a domain URN that does not match the real domain, an ingestion transformer that overwrites domains set in the UI, and missing privileges.
You Might Be Asking
- How do I assign a dataset to a domain?
- Can I move assets between domains?
- Why did my ingestion assign assets to a domain that does not exist?
- Why do domains I set in the UI disappear after ingestion?
Cause
-
Wrong domain URN. If you call
createDomainwithout anid, DataHub generates a random UUID as the domain id. The URN then looks likeurn:li:domain:<uuid>, not like the domain name. A URN you type by hand only works if it matches the real domain URN exactly, including letter case. -
Transformers do not check full URNs. A transformer value that starts with
urn:li:domain, or that looks like a UUID (four hyphens), is used as is and is never checked against the server. If the URN is wrong, for example because of different letter case, the transformer attaches assets to a domain that does not exist and reports no error. -
Default semantics are OVERWRITE. Transformers default to
semantics: OVERWRITE. They emit the computed domains without reading the domains already on the server. Onlysemantics: PATCHmerges with the server's domains. -
Missing privileges.
Manage DomainsandEdit Domainare separate privileges (see step 5).
Solution
-
Create a domain.
createDomainreturns the domain URN as a string.nameis required.id,description,parentDomainandownersare optional. If you omitowners, the current actor becomes the owner.
mutation createDomain {
createDomain(
input: {
id: "engineering",
name: "Engineering",
description: "Engineering team domain"
}
)
}
This creates urn:li:domain:engineering. Use that exact URN, with the same letter case, everywhere else. The call fails with This Domain already exists! if the id is taken, Parent Domain does not exist! if parentDomain is wrong, and "<name>" already exists in this domain. Please pick a unique name. for a duplicate name under the same parent. See the Domains API tutorial.
- Assign an asset to a domain. Use the exact domain URN.
mutation setDomain {
setDomain(
entityUrn: "urn:li:dataset:(urn:li:dataPlatform:snowflake,db.schema.table,PROD)",
domainUrn: "urn:li:domain:engineering"
)
}
batchSetDomain(input: BatchSetDomainInput!) assigns many assets at once. unsetDomain(entityUrn: String!) removes the domain from an asset.
In the Cloud UI, open the asset and use the Domain section of the sidebar's Summary tab. The button is a plus icon when the asset has no domain and a pencil icon when it has one. After you set a domain, it shows as a link in that section. To check the result, open the domain page and look at its Assets tab.
-
Move a domain under another domain.
moveDomain(input: { resourceUrn, parentDomain })changes the parent of a domain. A nullparentDomainremoves the parent. -
Assign domains in bulk during ingestion. Use
pattern_add_domain.pattern_add_domainneeds CLI version 1.5.0.9 or later. The olderpattern_add_dataset_domaintransformer still works, but it is deprecated, works only on datasets, and will be removed in a future release. Both take the same config, so to switch you only changetype. On a CLI older than 1.5.0.9,pattern_add_dataset_domainis the only option. Puttransformersat the top level of the recipe, next tosourceandsink. Undersource.configit fails validation. See the Pattern Add Domain docs.
source:
type: snowflake
config:
# source settings
transformers:
- type: "pattern_add_domain"
config:
semantics: PATCH
domain_pattern:
rules:
'urn:li:dataset:\(urn:li:dataPlatform:snowflake,finance\..*': ["urn:li:domain:finance"]
'urn:li:dataset:\(urn:li:dataPlatform:snowflake,engineering\..*': ["urn:li:domain:engineering"]
- Each rule value is a list, even for one domain. A bare string is not valid.
- Write regex keys in single quotes.
- The transformer matches keys with
re.match, which anchors at the start of the string. - Set
semantics: PATCHto keep domains that people set in the UI. -
replace_existingonly decides whether the transformer keeps domains that the source sends.Falsekeeps them andTruedrops them. It does not protect UI edits. - The transformer needs a server connection. Without one, the run fails with
AddDomain requires a datahub_api to connect to. Consider using the datahub-rest sink or provide a datahub_api: configuration on your ingestion recipe. - To fix this error, use the
datahub-restsink or add adatahub_apiblock to the recipe. Full domain URNs do not avoid this error. - The transformer looks up a plain domain name or id on the server. It tries
urn:li:domain:<value>first and then the display name. - If the transformer finds no domain, 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 .... - The transformer does not check full URNs. Confirm that each URN in the recipe matches a real domain.
-
Check privileges.
-
Manage Domains(MANAGE_DOMAINS): "Create and remove Asset Domains." -
Edit Domain(EDIT_DOMAINS_PRIVILEGE): "The ability to edit the Domain of an entity." - On Cloud, Domains is in the Govern group of the navigation sidebar.
-