Skip to content

Link domain and assets

Link your asset to a domain for easy discovery and governance.

Add an asset to a domain

2.4.6 2.0.0

You can add an asset to a domain or update an existing domain by updating the asset's domainGUIDs. In the example below, we're adding a Snowflake table (MARKETING_SALES) to the domain (Marketing).

Add an asset to a domain
1
2
3
4
5
6
7
8
9
DataDomain domain = DataDomain.findByName("Marketing").get(0); // (1)

Table table = Table.updater( // (2)
        "default/snowflake/1726834662/RAW/WIDEWORLDIMPORTERS/MARKETING_SALES",
        "MARKETING_SALES")
    .domainGUID(domain.getGuid()) // (3)
    .build();

AssetMutationResponse response = table.save(); // (4)
  1. You can retrieve a data domain by its human-readable name using the findByName() method.
  2. Use the updater() method of an asset by providing its qualifiedName and name.
  3. To add the asset to the domain, assign the guid of the domain to the domainGUID attribute.
  4. Finally, call the save() method to apply the changes in Atlan.
Add an asset to a domain
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import Table, 

client = AtlanClient()

domain = client.asset.find_domain_by_name("Marketing") # (1)

table = Table.updater( # (2)
    qualified_name="default/snowflake/1726834662/RAW/WIDEWORLDIMPORTERS/MARKETING_SALES",
    name="MARKETING_SALES",
)
table.domain_g_u_i_ds = [domain.guid]  # (3)

client.asset.save(table)  # (4)
  1. You can retrieve a data domain by its human-readable name using the find_domain_by_name() method.
  2. Use the updater() method of an asset by providing its qualifiedName and name.
  3. To add the asset to the domain, assign the guid of the domain to the asset.domain_g_u_i_ds attribute.
  4. Finally, call the save() method to apply the changes in Atlan.
Add an asset to a domain
1
2
3
4
5
6
7
8
9
val domain = DataDomain.findByName("Marketing")[0] // (1)

val table = Table.updater( // (2)
        "default/snowflake/1726834662/RAW/WIDEWORLDIMPORTERS/MARKETING_SALES",
        "MARKETING_SALES")
    .domainGUID(domain.getGuid()) // (3)
    .build()

val response = table.save() // (4)
  1. You can retrieve a data domain by its human-readable name using the findByName() method.
  2. Use the updater() method of an asset by providing its qualifiedName and name.
  3. To add the asset to the domain, assign the guid of the domain to the asset.domainGUID attribute.
  4. Finally, call the save() method to apply the changes in Atlan.
POST /api/meta/entity/bulk
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
{
  "entities": [
     {
       "typeName": "Table",  // (1)
       "attributes": {
         "qualifiedName": "default/snowflake/1726834662/RAW/WIDEWORLDIMPORTERS/MARKETING_SALES", // (2)
         "name": "MARKETING_SALES", // (3)
         "domainGUIDs": [
           "db711647-99a9-4c50-93c5-fab0b992a0cc" // (4)
         ]
       }
     }
   ]
 }
  1. You need to specify the typeName of the asset; for this example, we're updating the domainGUIDs for a Snowflake table.
  2. You need to specify the qualifiedName of the asset.
  3. You need to specify the name of the asset.
  4. To add the asset to the domain, assign the guid of the domain to the domainGUIDs property.

Remove an asset from a domain

2.4.6 2.0.0

You can remove an asset from a domain by updating the asset's domainGUIDs. In the example below, we're removing a Snowflake table (MARKETING_SALES) asset from the existing linked domain.

Remove an asset from a domain
1
2
3
4
5
6
7
Table table = Table.updater( // (1)
        "default/snowflake/1726834662/RAW/WIDEWORLDIMPORTERS/MARKETING_SALES",
        "MARKETING_SALES")
    .nullField(Table.DOMAIN_GUI_DS.getAtlanFieldName()) // (2)
    .build();

AssetMutationResponse response = table.save(); // (3)
  1. Use the updater() method of an asset by providing its qualifiedName and name.
  2. To remove the asset from the domain, set the domainGUIDs field as a nullField on the builder.
  3. Finally, call the save() method to apply the changes in Atlan.
Remove an asset from a domain
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import Table, 

client = AtlanClient()

table = Table.updater( # (1)
    qualified_name="default/snowflake/1726834662/RAW/WIDEWORLDIMPORTERS/MARKETING_SALES",
    name="MARKETING_SALES",
)
table.domain_g_u_i_ds = []  # (2)

client.asset.save(table)  # (3)
  1. Use the updater() method of an asset by providing its qualifiedName and name.
  2. To remove the asset from the domain, assign the domain_g_u_i_ds of the asset to an empty list ie.[].
  3. Finally, call the save() method to apply the changes in Atlan.
Remove an asset from a domain
1
2
3
4
5
6
7
val table = Table.updater( // (1)
        "default/snowflake/1726834662/RAW/WIDEWORLDIMPORTERS/MARKETING_SALES",
        "MARKETING_SALES")
    .nullField(Table.DOMAIN_GUI_DS.atlanFieldName) // (2)
    .build()

val response = table.save() // (3)
  1. Use the updater() method of an asset by providing its qualifiedName and name.
  2. To remove the asset from the domain, set the domainGUIDs field as a nullField on the builder.
  3. Finally, call the save() method to apply the changes in Atlan.
POST /api/meta/entity/bulk
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "entities": [
     {
       "typeName": "Table",  // (1)
       "attributes": {
         "qualifiedName": "default/snowflake/1726834662/RAW/WIDEWORLDIMPORTERS/MARKETING_SALES", // (2)
         "name": "MARKETING_SALES", // (3)
         "domainGUIDs": [] // (4)
       }
     }
   ]
 }
  1. You need to specify the typeName of the asset; for this example, we're updating the domainGUIDs for a Snowflake table.
  2. You need to specify the qualifiedName of the asset.
  3. You need to specify the name of the asset.
  4. To remove the asset from the domain, assign the domainGUIDs property of the asset to the empty array.