DataDomain: create and manage data domains
Create, update, and delete data domains in Atlan using the Python SDK (pyatlan) — use DataDomain.creator() to define domains with icons, colors, and hierarchies.
Use DataDomain in the Atlan Python SDK to programmatically create and manage data domains in your data mesh.
Create new data domain
To create a new data domain:
- Java
- Python
- Kotlin
- Raw REST API
DataDomain domain = DataDomain.creator("Marketing") // (1)
.assetIcon(AtlanIcon.ROCKET) // (2)
.assetThemeHex(AtlanMeshColor.MAGENTA)
.build(); // (3)
AssetMutationResponse response = domain.save(client); // (4)
- You must provide a human-readable name for your data domain.
- You can chain onto the creator any other enrichment, for example choosing a different icon or color to represent the domain.
- You then need to build the object.
- You can then
save()the object you've built to create the new data domain in Atlan. Because this operation will persist the asset in Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import DataDomain
from pyatlan.model.enums import AtlanIcon, AtlanMeshColor
client = AtlanClient()
domain = DataDomain.creator(
name="Marketing", # (1)
)
domain.asset_icon = AtlanIcon.ROCKET # (2)
domain.asset_theme_hex = AtlanMeshColor.MAGENTA
response = client.asset.save(domain) # (3)
- You must provide a human-readable name for your data domain.
- You can apply any other enrichment, for example choosing a different icon or color to represent the domain.
- You can then
save()the object to create the new data domain in Atlan.
val domain = DataDomain.creator("Marketing") // (1)
.assetIcon(AtlanIcon.ROCKET) // (2)
.assetThemeHex(AtlanMeshColor.MAGENTA)
.build() // (3)
val response = domain.save(client) // (4)
- You must provide a human-readable name for your data domain.
- You can chain onto the creator any other enrichment, for example choosing a different icon or color to represent the domain.
- You then need to build the object.
- You can then
save()the object you've built to create the new data domain in Atlan. Because this operation will persist the asset in Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
{
"entities": [
{
"typeName": "DataDomain", // (1)
"attributes": {
"name": "Marketing", // (2)
"assetIcon": "PhRocket", // (3)
"assetThemeHex": "#F34D77",
"qualifiedName": "default/domain/marketing" // (4)
}
}
]
}
- The
typeNamemust be exactlyDataDomain. - Human-readable name for your data domain.
- You can specify other enrichment, for example choosing a different icon or color to represent the domain.
- The
qualifiedNameshould follow the pattern:default/domain/<lowerCamelCaseName>.
Create new subdomain
To create a new subdomain:
- Java
- Python
- Kotlin
- Raw REST API
DataDomain sub = DataDomain.creator("Social Marketing", // (1)
DataDomain.refByQualifiedName("default/domain/marketing")) // (2)
.build(); // (3)
AssetMutationResponse response = sub.save(client); // (4)
- You must provide a human-readable name for your data domain.
- To create subdomain, you must provide the parent domain with at least its
qualifiedName. - You can chain on other enrichment, like above, but ultimately then need to build the object.
- You can then
save()the object you've built to create the new data subdomain in Atlan. Because this operation will persist the asset in Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import DataDomain
client = AtlanClient()
sub_domain = DataDomain.creator(
name="Social Marketing", # (1)
parent_domain_qualified_name="default/domain/marketing", # (2)
)
response = client.asset.save(sub_domain)
- Human-readable name for your data domain.
- To create subdomain, you must provide the parent domain
qualifiedName.
val sub = DataDomain.creator("Social Marketing", // (1)
DataDomain.refByQualifiedName("default/domain/marketing")) // (2)
.build() // (3)
val response = sub.save(client) // (4)
- You must provide a human-readable name for your data domain.
- To create subdomain, you must provide the parent domain with at least its
qualifiedName. - You can chain on other enrichment, like above, but ultimately then need to build the object.
- You can then
save()the object you've built to create the new data subdomain in Atlan. Because this operation will persist the asset in Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
{
"entities": [
{
"typeName": "DataDomain", // (1)
"attributes": {
"name": "Social Marketing", // (2)
"qualifiedName": "default/domain/gAbQGZNrFjG2F9lGB3hYp/super/domain/socialMarketing", // (3)
"parentDomainQualifiedName": "default/domain/gAbQGZNrFjG2F9lGB3hYp/super", // (4)
"superDomainQualifiedName": "default/domain/gAbQGZNrFjG2F9lGB3hYp/super" // (5)
},
"relationshipAttributes": {
"parentDomain": { // (6)
"typeName": "DataDomain",
"uniqueAttributes": {
"qualifiedName": "default/domain/gAbQGZNrFjG2F9lGB3hYp"
}
}
}
}
]
}
- The
typeNamemust be exactlyDataDomain. - Human-readable name for your data sub-domain.
- The
qualifiedNameshould follow the pattern:<parentQualifiedName>/domain/<lowerCamelCaseName>. - You must provide the
qualifiedNameof the parent domain. - Provide a
superDomainQualifiedNamefor the data domain under which you want to create this sub-domain. If creating a sub-domain under another sub-domains (ie. nested sub-domains), this should be the qualified name of the root-level domain. - You must also specify a relationship to the parent domain, in this example through its
qualifiedName.
Retrieve data domain
To retrieve a data domain by its human-readable name:
- Java
- Python
- Kotlin
- Raw REST API
DataDomain domain = DataDomain.findByName( // (1)
client, "marketing", List.of("certificateStatus")
).get(0);
-
Use
DataDomain.findByName()method to retrieve a data domain by its human-readable name:- client through which to access a tenant.
- name of the data domain.
- (optional) a list of attributes to retrieve for the data domain, for example
certificateStatus.
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import DataDomain
client = AtlanClient()
domain = client.asset.find_domain_by_name( # (1)
name="marketing",
attributes=["certificateStatus"]
)
assert domain
assert domain.certificate_status
-
Use
client.asset.find_domain_by_name()method to retrieve a data domain by its human-readable name:- name of the data domain.
- (optional) a list of attributes to retrieve
for the data domain, for example
certificateStatus.
val domain = DataDomain.findByName( // (1)
client, "marketing", listOf("certificateStatus")
).get(0)
-
Use
DataDomain.findByName()method to retrieve a data domain by its human-readable name:- client through which to access a tenant.
- name of the data domain.
- (optional) a list of attributes to retrieve for the data domain, for example
certificateStatus.
{
"dsl": {
"from": 0,
"size": 100,
"aggregations": {},
"track_total_hits": true,
"query": {
"bool": {
"filter": [
{
"term": {
"name.keyword": {
"value": "marketing" // (1)
}
}
},
{
"term": {
"__typeName.keyword": {
"value": "DataDomain"
}
}
}
]
}
},
"sort": [
{
"__guid": {
"order": "asc"
}
}
]
},
"attributes": [
"certificateStatus" // (2)
]
}
- Human-readable name of the data domain.
- (optional) a list of attributes to retrieve
for the data domain, for example
certificateStatus.
Update data domain
To update a data domain or subdomain:
- Java
- Python
- Kotlin
- Raw REST API
DataDomain domain = DataDomain.updater("default/domain/marketing", // (1)
"Marketing")
.userDescription("Now with a description!") // (2)
.build(); // (3)
AssetMutationResponse response = domain.save(client); // (4)
- Use the
updater()method to update a data domain, providing thequalifiedNameand name of the data domain. - You can chain onto the updater any other enrichment, for example changing the domain's description.
- You then need to build the object.
- You can then
save()the object you've built to update the data domain in Atlan. Because this operation will persist the asset in Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import DataDomain
client = AtlanClient()
data_domain = DataDomain.updater( # (1)
qualified_name="default/domain/marketing", # (2)
name="Marketing", # (3)
)
data_domain.user_description = "Now with a description!" # (4)
response = client.asset.save(data_domain) # (5)
- Use the
updater()method to update a data domain. - You must provide the
qualifiedNameof the data domain. - You must provide the
nameof the data domain. - You can then add on any other updates, such as changing the user description of the data domain.
- To update the data domain in Atlan, call the
save()method with the object you've built.
val domain = DataDomain.updater("default/domain/marketing", // (1)
"Marketing")
.userDescription("Now with a description!") // (2)
.build() // (3)
val response = domain.save(client) // (4)
- Use the
updater()method to update a data domain, providing thequalifiedNameand name of the data domain. - You can chain onto the updater any other enrichment, for example changing the domain's description.
- You then need to build the object.
- You can then
save()the object you've built to update the data domain in Atlan. Because this operation will persist the asset in Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
{
"entities": [
{
"typeName": "DataDomain", // (1)
"attributes": {
"name": "Marketing", // (2)
"qualifiedName": "default/domain/marketing", // (3)
"userDescription": "Now with a description!" // (4)
},
}
]
}
- The
typeNamemust be exactlyDataDomain. - Human-readable name for your data domain.
- You must provide the the
qualifiedNameof the domain to update. - You can add on any other updates, such as changing the user description of the data domain.
Delete data domain
Soft-delete (archive)
To soft-delete, or archive, a data domain:
- Java
- Python
- Kotlin
- Raw REST API
AssetDeletionResponse response = DataDomain.delete(client, "218c8144-dc39-43a5-b0c0-9eeb4d11e74a"); // (1)
- To archive a data domain in Atlan, call the
DataDomain.delete()method with the GUID of the data domain. Because this operation will archive the asset in Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
from pyatlan.client.atlan import AtlanClient
client = AtlanClient()
client.asset.delete_by_guid("218c8144-dc39-43a5-b0c0-9eeb4d11e74a") # (1)
- To archive a data domain in Atlan, call the
asset.delete_by_guid()method with the GUID of the data domain.
val response = DataDomain.delete(client, "218c8144-dc39-43a5-b0c0-9eeb4d11e74a") // (1)
- To archive a data domain in Atlan, call the
DataDomain.delete()method with the GUID of the data domain. Because this operation will archive the asset in Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
// (1)
- All the details for deleting the data domain are specified in the URL directly. Note that you must provide the GUID of the data domain to delete it.
Hard-delete (purge)
To permanently delete (purge) a data domain:
- Java
- Python
- Kotlin
- Raw REST API
AssetDeletionResponse response = DataDomain.purge(client, "218c8144-dc39-43a5-b0c0-9eeb4d11e74a"); // (1)
- To permanently delete a data domain in Atlan, call the
DataDomain.purge()method with the GUID of the data domain. Because this operation will remove the asset from Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
from pyatlan.client.atlan import AtlanClient
client = AtlanClient()
client.asset.purge_by_guid("218c8144-dc39-43a5-b0c0-9eeb4d11e74a") # (1)
- To permanently delete a data domain in Atlan, call the
asset.purge_by_guid()method with the GUID of the data domain.
val response = DataDomain.purge("218c8144-dc39-43a5-b0c0-9eeb4d11e74a") // (1)
- To permanently delete a data domain in Atlan, call the
DataDomain.purge()method with the GUID of the data domain. Because this operation will remove the asset from Atlan, you must provide it anAtlanClientthrough which to connect to the tenant.
// (1)
- All the details for deleting the data domain are specified in the URL directly. Note that you must provide the GUID of the data domain to delete it.