Release Notes
This release completes support for Apache Atlas 2.2 supported features in Azure Purview.
New Features
Business Metadata
* Deleting a specific business attribute from an entity
python
resp = client.delete_businessMetadata(
guid="f222242b-e304-4123-9747-47f6f6f60000",
businessMetadata={"operations":{"expenseCode":""}}
)
print(resp)
* Add Business Metadata to an Existing Entity
python
resp = client.update_businessMetadata(
guid="f222242b-e304-4123-9747-47f6f6f60000",
businessMetadata={
"operations":{"expenseCode":"1011"}
}
)
print(resp)
Highlighting Existing Features for Atlas 2.2 Support
Business Metadata
* Creating a BusinessMetadata typedef
python
from pyapacheatlas.core.typedef import AtlasAttributeDef, AtlasStructDef, TypeCategory
bizdef = AtlasStructDef(
name="operations",
category=TypeCategory.BUSINESSMETADATA,
attributeDefs=[
AtlasAttributeDef(name="expenseCode",options={"maxStrLength": "500","applicableEntityTypes":"[\"DataSet\"]"}),
AtlasAttributeDef(name="criticality",options={"maxStrLength": "500", "applicableEntityTypes":"[\"DataSet\"]"})
]
)
resp = client.upload_typedefs(businessMetadataDefs=[bizdef])
print(resp)
* Add Business Metadata to a New Entity
python
entity = AtlasEntity(
name="mytable",
typeName="azure_sql_table",
qualified_name="mssql://myserver/mydb/myschema/mytable",
guid="-1"
)
entity.addBusinessAttribute(operations={"expenseCode":"123", "criticality":"low"})
resp = client.upload_entities([entity])
print(resp)
Custom Attributes
* Add a Custom Attribute to a New Entity
python
entity = AtlasEntity(
name="mycustomtable",
typeName="azure_sql_table",
qualified_name="mssql://myserver/mydb/myschema/mycustomtable",
guid="-1"
)
entity.addCustomAttribute(foo="bar", buz="qux")
resp = client.upload_entities([entity])
print(resp)
* Add a Custom Attribute to an Existing Entity
* This really stinks because you are using the /entity endpoint and must specify all required attributes.
* You may consider using a `client.get_single_entity` for a given entity and extract the existing custom attributes.
python
existing_entity = AtlasEntity(
name="mycustomtable",
typeName="azure_sql_table",
qualified_name="mssql://myserver/mydb/myschema/mycustomtable",
guid="-1"
)
Note that we've changed foo to baz which will update foo and we still specify buz to keep it around
existing_entity.addCustomAttribute(foo="baz", buz="qux")
resp = client.upload_entities([existing_entity])
print(resp)
* Delete a Custom Attribute from an Existing Entity
* See comments above, you're just updating the entity without the or any of the custom attributes.
python
existing_entity = AtlasEntity(
name="mycustomtable",
typeName="azure_sql_table",
qualified_name="mssql://myserver/mydb/myschema/mycustomtable",
guid="-1"
)
Note we've omitted the foo attribute meaning we will delete it
existing_entity.addCustomAttribute(buz="qux")
resp = client.upload_entities([existing_entity])
print(resp)
Custom Labels
* Add Custom Labels to a New Entity
python
entity = AtlasEntity(
name="mylabeledtable",
typeName="azure_sql_table",
qualified_name="mssql://myserver/mydb/myschema/mylabeledtable",
guid="-1",
labels= ["a", "b", "c"]
)
resp = client.upload_entities([entity])
print(resp)
* Append new custom labels (without overwriting)
python
resp = client.update_entity_labels(labels=['d','e'],
guid="57b23112-d665-44c5-afb0-b4f6f6f60000",
force_update=False
)
print(resp)
* Completely overwrite custom labels with a new set of labels
python
resp = client.update_entity_labels(labels=['j','k', 'l'],
guid="57b23112-d665-44c5-afb0-b4f6f6f60000",
force_update=True
)
print(resp)
* Remove one or many Custom Labels
python
resp = client.delete_entity_labels(labels=['j','k'],
guid="57b23112-d665-44c5-afb0-b4f6f6f60000",
force_update=True
)
print(resp)
Bug Fixes
* An error was occuring when using `upload_typedefs` and the `force_update=True` flag was set.
Breaking Changes
* An internal method `_get_typedefs_header` modified its response for busienss_metadataDefs to businessMetadataDefs.