Skip to main content
Version: 0.12.0

Domains

Why Would You Use Domains?

Domains are curated, top-level folders or categories where related assets can be explicitly grouped. Management of Domains can be centralized, or distributed out to Domain owners Currently, an asset can belong to only one Domain at a time. For more information about domains, refer to About DataHub Domains.

Goal Of This Guide

This guide will show you how to

  • Create a domain.
  • Read domains attached to a dataset.
  • Add a dataset to a domain
  • Remove the domain from a dataset.

Prerequisites

For this tutorial, you need to deploy DataHub Quickstart and ingest sample data. For detailed steps, please refer to Datahub Quickstart Guide.

Create Domain

mutation createDomain {
createDomain(input: { name: "Marketing", description: "Entities related to the marketing department" })
}

If you see the following response, the operation was successful:

{
"data": {
"createDomain": "<domain_urn>"
},
"extensions": {}
}

Expected Outcomes of Creating Domain

You can now see Marketing domain has been created under Govern > Domains.

Read Domains

query {
dataset(urn: "urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)") {
domain {
associatedUrn
domain {
urn
properties {
name
}
}
}
}
}

If you see the following response, the operation was successful:

{
"data": {
"dataset": {
"domain": {
"associatedUrn": "urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)",
"domain": {
"urn": "urn:li:domain:71b3bf7b-2e3f-4686-bfe1-93172c8c4e10",
"properties": {
"name": "Marketing"
}
}
}
}
},
"extensions": {}
}

Add Domains

mutation setDomain {
setDomain(domainUrn: "urn:li:domain:marketing", entityUrn: "urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)")
}

If you see the following response, the operation was successful:

{
"data": {
"setDomain": true
},
"extensions": {}
}

Expected Outcomes of Adding Domain

You can now see Marketing domain has been added to the dataset.

Remove Domains

mutation unsetDomain {
unsetDomain(
entityUrn:"urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)"
)
}

Expected Response:

{
"data": {
"removeDomain": true
},
"extensions": {}
}

Expected Outcomes of Removing Domain

You can now see a domain Marketing has been removed from the fct_users_created dataset.