Skip to main content

Change custom metadata on assets

Structures must exist before setting values on assets

Remember that you must first create the custom metadata structures before you will be able to set or change any values for custom metadata on an asset.

Value representation

To update custom metadata values on an asset, you need to use the correct representation:

Property typeValue representationExample
TextString"a value"
IntegerNumber: without decimals42
DecimalNumber: with decimals42.0
BooleanBoolean: either true or falsetrue
DateNumber: milliseconds since epoch (January 1, 1970), to a specific day1681171200000
OptionsString: exact value from the options list"success"
UsersString: username of the user"jsmith"
GroupsString: unique name of the group, which appears under the name of the group in the UI list of groups"finance"
URLString: starting with http[s]://https://www.google.com
SQLString"SELECT *\nFROM somewhere;"
Multi-value attributes

Custom attributes in Atlan can be configured to allow multiple values. For these, you must wrap all values in a multi-valued collection, even if there is only a single value you are setting. Each value in that collection needs to follow the appropriate representation as indicated in the table above.

For example, if you want to set just a single group in a field that allows multiple values:

dbt

Multi-valued attribute
models:
- name: TOP_BEVERAGE_USERS
meta:
atlan:
businessAttributes:
MNJ8mpLsIOaP4OQnLNhRta:
F8XI9GzcBpdBdfi4cLiPEz:
- "finance" # (1)
  1. You must provide the values as a list in YAML: each value on a new line, indented below the attribute, and prefixed with - .

    Java

Multi-valued attribute
CustomMetadataAttributes cmRACI = CustomMetadataAttributes.builder()
.attribute("Consulted", List.of("finance")) // (1)
.build();
  1. You must provide the values as a collection (List, Set, etc).

    Python

Multi-valued attribute
from pyatlan.model.custom_metadata import CustomMetadataDict

cm_RACI = CustomMetadataDict(client=client, name="RACI") # (1)
cm_RACI["Consulted"] = ["finance"] # (2)
  1. Provide the client instance and name of the custom metadata set.

    Name will be validated

The name will be validated at runtime to make sure that a custom metadata set with the given name exists. ::: 2. For any property that can be multi-valued, we need to send a list of values.

Name will be validated

The metadata property name will be validated at runtime to make sure that a property with the given name exists in the custom metadata set.

Kotlin

Multi-valued attribute
val cmRACI = CustomMetadataAttributes.builder()
.attribute("Consulted", listOf("finance")) // (1)
.build()
  1. You must provide the values as a collection (List, Set, etc).

    Raw REST API

POST /api/meta/entity/guid/a89ff15b-f5e6-48bc-870b-acfa11e212ae/businessmetadata/MNJ8mpLsIOaP4OQnLNhRta
{
"MNJ8mpLsIOaP4OQnLNhRta": {
"F8XI9GzcBpdBdfi4cLiPEz": [ // (1)
"finance"
]
}
}
  1. You must provide the values in a JSON-style array.

Add to existing assets

Update only some custom metadata attributes

To update only some custom metadata attributes (leaving all others unchanged):

This is currently not possible via dbt, custom metadata is replaced rather than selectively updated.

Replace some custom metadata on asset

You can also add/replace an entire set of custom metadata to existing assets. If you do this individually, you can selectively update individual sets of custom metadata (leaving any others unchanged):

Replace some custom metadata on an asset
models:
- name: TOP_BEVERAGE_USERS # (1)
meta:
atlan:
businessAttributes: # (2)
MNJ8mpLsIOaP4OQnLNhRta: # (3)
fWMB77RSjRGNYoFeD4FcGi: jsmith # (4)
F8XI9GzcBpdBdfi4cLiPEz: [ "finance", "risk" ] # (5)
businessAttributeNames: # (6)
RACI:
Informed:
- "marketing"
  1. You must of course give the name of the object.
  2. The custom metadata must be nested within the meta.atlan.businessAttributes structure.
  3. Each custom metadata set you want to add or update must be given using its hashed-string representation.
  4. Each custom metadata attribute you want to update must be given using its hashed-string representation.
  5. For multivalued custom metadata attributes, specify the value as an array.
  6. You can use displayNames instead of hashed-string representations by nesting custom metadata within meta.atlan.businessAttributeNames structure.

Replace all custom metadata on asset

Could create a new asset

Remember that Atlan matches the provided qualifiedName to determine whether to update or create the asset.

You can also replace all the custom metadata on one or many existing assets at the same time.

Replaces any existing custom metadata

This approach will replace all existing custom metadata (across all attributes) on the asset. If you have only a few custom metadata attributes defined in the update, this will remove any other custom metadata attributes that are already set on the asset within Atlan.

Replace all custom metadata on existing assets
models:
- name: TOP_BEVERAGE_USERS # (1)
meta:
atlan:
businessAttributes: # (2)
MNJ8mpLsIOaP4OQnLNhRta: # (3)
fWMB77RSjRGNYoFeD4FcGi: jsmith # (4)
F8XI9GzcBpdBdfi4cLiPEz: [ "finance", "risk" ] # (5)
foMg7yOwUajucuya0JEF4J: # (6)
uTmK5o0J8jHTH3KWFXXeZi: example # (7)
  1. You must of course give the name of the object.
  2. The custom metadata must be nested within the meta.atlan.businessAttributes structure.
  3. Each custom metadata set you want to add or update must be given using its hashed-string representation.
  4. Each custom metadata attribute you want to update must be given using its hashed-string representation.
  5. For multivalued custom metadata attributes, specify the value as an array.
  6. Additional custom metadata sets would be listed as additional sub-objects of the businessAttributes object. (Still using a hashed-string representation.)
  7. ...and custom metadata attributes within those sets would be listed as sub-objects of the custom metadata set object. (Still using a hashed-string representation.)

Remove from existing asset

Remove only some custom metadata attributes

To remove only some custom metadata attributes (leaving all others unchanged):

This currently isn't possible via dbt.

Remove some custom metadata from asset

You can also remove an entire set of custom metadata from existing assets. If you do this individually, you can selectively remove individual sets of custom metadata:

Remove some custom metadata from an existing asset
models:
- name: TOP_BEVERAGE_USERS # (1)
meta:
atlan:
businessAttributes:
MNJ8mpLsIOaP4OQnLNhRta: {} # (2)
  1. You must of course give the name of the object.
  2. The custom metadata must be nested within the meta.atlan.businessAttributes structure. To remove all properties for some custom metadata, send an explicit empty dictionary {} to the custom metadata's hashed-string representation.

Remove all custom metadata from asset

Could create a new asset

Remember that Atlan matches the provided qualifiedName to determine whether to update or create the asset.

To remove all custom metadata from an existing asset:

Remove all custom metadata from an existing asset
models:
- name: TOP_BEVERAGE_USERS # (1)
meta:
atlan:
businessAttributes: {} # (2)
  1. You must of course give the name of the object.
  2. The custom metadata must be nested within the meta.atlan.businessAttributes structure. To remove all custom metadata, send an explicit empty dictionary {}.

When creating asset

To add custom metadata when creating one or many assets:

Add custom metadata when creating asset
models:
- name: TOP_BEVERAGE_USERS # (1)
meta:
atlan:
businessAttributes: # (2)
MNJ8mpLsIOaP4OQnLNhRta: # (3)
fWMB77RSjRGNYoFeD4FcGi: jsmith # (4)
xDUCZllc4JyTKhwqSDkWK4: jdoe
F8XI9GzcBpdBdfi4cLiPEz: [ "finance", "risk" ] # (5)
rN6H6xMQpyHvo639SXER83: [ "operations" ]
  1. You must of course give the name of the object.
  2. The custom metadata must be nested within the meta.atlan.businessAttributes structure.
  3. Each custom metadata set you want to add or update must be given using its hashed-string representation.
  4. Each custom metadata attribute you want to update must be given using its hashed-string representation.
  5. For multivalued custom metadata attributes, specify the value as an array.

Find hashed-string names

When using either the raw APIs or specifying businessAttributes with dbt, you must provide the classification names using Atlan's hashed-string representation.

Not necessary for SDKs

Note that this isn't needed when using the SDKs, which translate these for you!

To look up the hashed-string representations:

The response will include displayName and name, both at overall custom metadata level and for each attribute (property). The displayName is what you see in Atlan's UI, and the name is the hashed-string representation:

Simplified response
{
"enumDefs": [],
"structDefs": [],
"classificationDefs": [],
"entityDefs": [],
"relationshipDefs": [],
"businessMetadataDefs": [
{
"category": "BUSINESS_METADATA",
"guid": "e5cc3476-9cd9-4ed7-89a7-18dfde86f827",
"name": "MNJ8mpLsIOaP4OQnLNhRta",
"displayName": "RACI",
"options": {
"logoType": "emoji",
"emoji": "👪"
},
"attributeDefs": [
{
"name": "fWMB77RSjRGNYoFeD4FcGi",
"displayName": "Responsible",
"cardinality": "SINGLE",
"typeName": "string",
"description": "",
"options": {
"customType": "users",
"showInOverview": "false",
"allowFiltering": "true",
"isEnum": "false",
"multiValueSelect": "false",
"primitiveType": "users"
}
},
{
"name": "xDUCZllc4JyTKhwqSDkWK4",
"displayName": "Accountable",
"cardinality": "SINGLE",
"typeName": "string",
"description": "",
"options": {
"customType": "users",
"showInOverview": "false",
"allowFiltering": "true",
"isEnum": "false",
"multiValueSelect": "false",
"primitiveType": "users"
}
},
{
"name": "F8XI9GzcBpdBdfi4cLiPEz",
"displayName": "Consulted",
"typeName": "array<string>",
"cardinality": "SET",
"description": "",
"options": {
"customType": "groups",
"showInOverview": "false",
"allowFiltering": "true",
"isEnum": "false",
"multiValueSelect": "true",
"primitiveType": "groups"
}
},
{
"name": "rN6H6xMQpyHvo639SXER83",
"displayName": "Informed",
"typeName": "array<string>",
"cardinality": "SET",
"description": "",
"options": {
"customType": "groups",
"showInOverview": "false",
"allowFiltering": "true",
"isEnum": "false",
"multiValueSelect": "true",
"primitiveType": "groups"
}
},
{
"name": "okm7BDXjTQx4iYPT5u7ilu",
"displayName": "Extra",
"typeName": "string",
"cardinality": "SINGLE",
"description": "",
"options": {
"showInOverview": "false",
"allowFiltering": "true",
"isEnum": "false",
"multiValueSelect": "false",
"primitiveType": "string"
}
}
]
},
{
"category": "BUSINESS_METADATA",
"guid": "389c0f8a-5d68-407c-8b5c-45a19f2cc7e0",
"name": "foMg7yOwUajucuya0JEF4J",
"displayName": "Other",
"options": {
"logoType": "emoji",
"emoji": "❓"
},
"attributeDefs": [
{
"name": "uTmK5o0J8jHTH3KWFXXeZi",
"displayName": "Another",
"typeName": "string",
"cardinality": "SINGLE",
"description": "",
"options": {
"showInOverview": "false",
"allowFiltering": "true",
"isEnum": "false",
"multiValueSelect": "false",
"primitiveType": "string"
}
}
]
}
]
}
Was this page helpful?