/api/meta/entity/uniqueAttribute/type/{typeName}/classifications?attr:qualifiedName={qualifiedName} (POST)
/api/meta/entity/bulk (POST)
/api/meta/entity/uniqueAttribute/type/{typeName}/classification/{name}?attr:qualifiedName={qualifiedName} (DELETE)
Tag (classify) assets
Atlan tags must exist before tagging assets
Remember that you must first create the Atlan tag before you will be able to tag any assets.
Cannot add tags when creating assets
Currently it is not possible to add tags when creating assets , other than via dbt.
Add to an existing asset
1.4.0
4.0.0
To add tags to an existing asset:
Add tags to an existing asset 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 models :
- name : TOP_BEVERAGE_USERS #
meta :
atlan :
classificationNames : #
- PII #
- Marketing Analysis
classificationNames : #
- name : PII #
propagate : true #
removePropagationsOnEntityDelete : true #
restrictPropagationThroughLineage : false #
restrictPropagationThroughHierarchy : false #
- name : Marketing Analysis
propagate : true
removePropagationsOnEntityDelete : true
restrictPropagationThroughLineage : false
restrictPropagationThroughHierarchy : false
classifications : #
- typeName : yQBDoKHdTLJhqAsdR3RMq6 #
propagate : true
removePropagationsOnEntityDelete : true
restrictPropagationThroughLineage : false
restrictPropagationThroughHierarchy : false
- typeName : WCVjmgKnW40G151dESXZ03
propagate : true
removePropagationsOnEntityDelete : true
restrictPropagationThroughLineage : false
restrictPropagationThroughHierarchy : false
Replaces all tags
Unlike the examples for the SDKs and raw APIs, dbt will always replace all tags on the asset. Any tags that already exist on the asset that are not specified here will be removed.
Add tags to an existing asset Table . appendAtlanTags ( //
client , //
"default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" , //
List . of ( "PII" , "Marketing Analysis" )); //
Add tags to an existing asset from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import Table
client = AtlanClient ()
client . asset . add_atlan_tags ( #
asset_type = Table ,
qualified_name = "default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" ,
atlan_tag_names = [ "PII" , "Marketing Analysis" ], #
)
Add tags to an existing asset val table = Table . appendAtlanTags ( //
client , //
"default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" , //
listOf ( "PII" , "Marketing Analysis" )) //
POST /api/meta/entity/uniqueAttribute/type/Table/classifications?attr:qualifiedName=default%2Fsnowflake%2F1657037873%2FSAMPLE_DB%2FFOOD_BEV%2FTOP_BEVERAGE_USERS 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 [
{
"typeName" : "yQBDoKHdTLJhqAsdR3RMq6" , //
"propagate" : true , //
"removePropagationsOnEntityDelete" : true , //
"restrictPropagationThroughLineage" : false , //
"restrictPropagationThroughHierarchy" : false //
},
{
"typeName" : "WCVjmgKnW40G151dESXZ03" ,
"propagate" : true ,
"removePropagationsOnEntityDelete" : true ,
"restrictPropagationThroughLineage" : false ,
"restrictPropagationThroughHierarchy" : false
}
]
Update on an existing asset
1.6.4
4.0.0
To update tags on an existing asset:
Not possible through dbt
In dbt, the tags will be replaced in their entirety. It is not possible to just update a single tag through dbt.
Update tags on an existing asset Table . updateAtlanTags ( //
client , //
"default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" , //
List . of ( "PII" , "Marketing Analysis" ), //
true , //
true , //
false , //
false //
);
Update tags on an existing asset 1
2
3
4
5
6
7
8
9
10
11
12
13 from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import Table
client = AtlanClient ()
client . asset . update_atlan_tags ( #
asset_type = Table ,
qualified_name = "default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" ,
atlan_tag_names = [ "PII" , "Marketing Analysis" ], #
True , #
True , #
False , #
False , #
)
Update tags on an existing asset val table = Table . updateAtlanTags ( //
client , //
"default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" , //
listOf ( "PII" , "Marketing Analysis" ), //
true , //
true , //
false , //
false //
)
PUT /api/meta/entity/uniqueAttribute/type/Table/classifications?attr:qualifiedName=default%2Fsnowflake%2F1657037873%2FSAMPLE_DB%2FFOOD_BEV%2FTOP_BEVERAGE_USERS 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 [
{
"typeName" : "yQBDoKHdTLJhqAsdR3RMq6" , //
"propagate" : true , //
"removePropagationsOnEntityDelete" : true , //
"restrictPropagationThroughLineage" : false , //
"restrictPropagationThroughHierarchy" : false //
},
{
"typeName" : "WCVjmgKnW40G151dESXZ03" ,
"propagate" : true ,
"removePropagationsOnEntityDelete" : true ,
"restrictPropagationThroughLineage" : false ,
"restrictPropagationThroughHierarchy" : false
}
]
Remove from existing assets
Remove a single tag
1.4.0
4.0.0
To remove a single tag from an existing asset:
Could create a new asset
Remember that Atlan matches the provided qualifiedName
to determine whether to update or create the asset .
2.0.0
4.0.0
To remove all tags from an existing asset, you need to specify no tags in your object:
In bulk
2.5.4
4.0.0
You can modify many tags, for many assets, at the same time.
Operates as a replace
Applying tags in bulk can currently only be done as a replacement. All tags on the asset(s) you upate will be replaced with the tags you specify. This means any tags that already exist on the asset in Atlan that are not in your update will be removed from that asset.
Replace tags on multiple assets 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 models :
- name : TOP_BEVERAGE_USERS #
meta :
atlan :
classificationNames : #
- PII #
- Marketing Analysis
classificationNames : #
- name : PII #
propagate : true #
removePropagationsOnEntityDelete : true #
restrictPropagationThroughLineage : false #
restrictPropagationThroughHierarchy : false #
- name : Marketing Analysis
propagate : true
removePropagationsOnEntityDelete : true
restrictPropagationThroughLineage : false
restrictPropagationThroughHierarchy : false
classifications : #
- typeName : yQBDoKHdTLJhqAsdR3RMq6 #
propagate : true
removePropagationsOnEntityDelete : true
restrictPropagationThroughLineage : false
restrictPropagationThroughHierarchy : false
- typeName : WCVjmgKnW40G151dESXZ03
propagate : true
removePropagationsOnEntityDelete : true
restrictPropagationThroughLineage : false
restrictPropagationThroughHierarchy : false
- name : ANOTHER_ASSET #
meta :
atlan :
classificationNames :
- ...
Replace tags on multiple assets 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Table table = Table . updater ( //
"default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" , "TOP_BEVERAGE_USERS" )
. atlanTag ( AtlanTag . of ( "PII" )) //
. atlanTag ( AtlanTag . builder () //
. typeName ( "Marketing Analysis" )
. propagate ( true )
. removePropagationsOnEntityDelete ( true )
. restrictPropagationThroughLineage ( false )
. restrictPropagationThroughHierarchy ( false )
. build ())
. atlanTag ( AtlanTag . of ( "Sensitivity" , //
SourceTagAttachment . byName ( client , //
SourceTagCache . SourceTagName ( "snowflake/development@@DB/SCH/SENSITIVITY" ), //
List . of ( SourceTagAttachmentValue . of ( null , "Restricted" ))))) //
. build ();
AtlanMutationResponse response = table . save ( client , true ); //
Replace tags on multiple assets 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import Table
from pyatlan.model.core import AtlanTag , AtlanTagName
from pyatlan.cache.source_tag_cache import SourceTagName
from pyatlan.model.structs import SourceTagAttachment , SourceTagAttachmentValue
client = AtlanClient ()
table = Table . updater ( #
qualified_name = "default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" ,
name = "TOP_BEVERAGE_USERS" ,
)
table . atlan_tags = [ #
AtlanTag . of ( atlan_tag_name = AtlanTagName ( "PII" )),
AtlanTag (
type_name = AtlanTagName ( "Marketing Analysis" ), #
remove_propagations_on_entity_delete = True ,
restrict_propagation_through_lineage = False ,
restrict_propagation_through_hierarchy = False ,
),
AtlanTag . of ( #
atlan_tag_name = AtlanTagName ( "Sensitivity" ),
source_tag_attachment = SourceTagAttachment . by_name (
name = SourceTagName ( "snowflake/development@@DB/SCH/SENSITIVITY" ), #
source_tag_values = [
SourceTagAttachmentValue (
tag_attachment_key = "" , tag_attachment_value = "Restricted"
) #
],
),
),
]
response = client . asset . save ( table , replace_atlan_tags = True ) #
Add tags to an existing asset 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 val table = Table . updater ( //
"default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" , "TOP_BEVERAGE_USERS" )
. atlanTag ( AtlanTag . of ( "PII" )) //
. atlanTag ( AtlanTag . builder () //
. typeName ( "Marketing Analysis" )
. propagate ( true )
. removePropagationsOnEntityDelete ( true )
. restrictPropagationThroughLineage ( false )
. restrictPropagationThroughHierarchy ( false )
. build ())
. atlanTag ( AtlanTag . of ( "Sensitivity" , //
SourceTagAttachment . byName ( client , //
SourceTagCache . SourceTagName ( "snowflake/development@@DB/SCH/SENSITIVITY" ), //
listOf ( SourceTagAttachmentValue . of ( null , "Restricted" ))))) //
. build ()
val response = table . save ( client , true ) //
POST /api/meta/entity/bulk 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 {
"entities" : [ //
{
"typeName" : "Table" , //
"attributes" : {
"name" : "TOP_BEVERAGE_USERS" , //
"qualifiedName" : "default/snowflake/1657037873/SAMPLE_DB/FOOD_BEV/TOP_BEVERAGE_USERS" //
},
"classifications" : [ //
{
"typeName" : "yQBDoKHdTLJhqAsdR3RMq6" , //
"propagate" : true , //
"removePropagationsOnEntityDelete" : true , //
"restrictPropagationThroughLineage" : false , //
"restrictPropagationThroughHierarchy" : false //
},
{
"typeName" : "WCVjmgKnW40G151dESXZ03" ,
"propagate" : true ,
"removePropagationsOnEntityDelete" : true ,
"restrictPropagationThroughLineage" : false ,
"restrictPropagationThroughHierarchy" : false
},
{
"typeName" : "Z96sGJrF0S68PxYTUdKG6b" ,
"propagate" : true ,
"removePropagationsOnEntityDelete" : true ,
"restrictPropagationThroughLineage" : false ,
"restrictPropagationThroughHierarchy" : false ,
"attributes" : { //
"rt5N3mHZTcxXafuu6ZPpyL" : [ //
{
"sourceTagName" : "CONFIDENTIAL" , //
"sourceTagQualifiedName" : "default/snowflake/1726834662/ANALYTICS/WIDE_WORLD_IMPORTERS/CONFIDENTIAL" , //
"sourceTagGuid" : "c28c08a8-320b-4a1a-b52e-75d120b4a8cc" , //
"sourceTagConnectorName" : "snowflake" , //
"isSourceTagSynced" : false ,
"sourceTagSyncTimestamp" : 0 ,
"sourceTagValue" : [ //
{
"tagAttachmentValue" : "Highly Restricted" //
}
]
}
]
}
}
]
}
]
}
Find hashed-string names
When using either the raw APIs or dbt, you must provide the custom metadata names using Atlan's hashed-string representation.
Not necessary for SDKs
Note that this is not needed when using the SDKs, which translate these for you!
To look up the hashed-string representations:
GET /api/meta/types/typedefs?type=classification
The response will include displayName
and name
for each tag. The displayName
is what you see in Atlan's UI, and the name
is the hashed-string representation:
Simplified response 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 {
"enumDefs" : [],
"structDefs" : [],
"classificationDefs" : [
{
"category" : "CLASSIFICATION" ,
"guid" : "c43e2f52-975f-40b6-88fa-93697fb54f52" ,
"name" : "WCVjmgKnW40G151dESXZ03" , //
"displayName" : "Marketing Analysis" ,
"description" : "Assets relevant to the marketing domain"
},
{
"category" : "CLASSIFICATION" ,
"guid" : "ec641061-d8fa-4090-9145-a5f23c9c3e99" ,
"name" : "yQBDoKHdTLJhqAsdR3RMq6" , //
"displayName" : "PII" ,
"description" : "Personally-identifiable information can be used to uniquely identify an individual person."
},
{
"category" : "CLASSIFICATION" ,
"guid" : "70211696-f3fb-4a4a-a81a-db589e29f436" ,
"name" : "Z96sGJrF0S68PxYTUdKG6b" , //
"displayName" : "Sensitivity" ,
"attributeDefs" : [
{
"name" : "rt5N3mHZTcxXafuu6ZPpyL" , //
"displayName" : "sourceTagAttachment" ,
"description" : "" ,
"typeName" : "array<SourceTagAttachment>" ,
"isDefaultValueNull" : false ,
"isOptional" : true ,
"cardinality" : "SET" ,
"valuesMinCount" : 0 ,
"valuesMaxCount" : 2147483647 ,
"isUnique" : false ,
"isIndexable" : false ,
"includeInNotification" : false ,
"skipScrubbing" : false ,
"searchWeight" : -1 ,
"isNew" : true
}
],
}
],
"entityDefs" : [],
"relationshipDefs" : [],
"businessMetadataDefs" : []
}
2 years ago 2022-08-22
3 months ago 2024-12-11