for page in search: print(json.dumps(page, indent=2)) # COMMAND ---------- # MAGIC %md # MAGIC #####3. Bulk delete upto 50 entities # COMMAND ---------- import json import os search = client.search_entities("databricksassets") for page in search: print(page["id"]) delete_response = client.delete_entity(guid=page["id"]) print(json.dumps(delete_response, indent=2)) # COMMAND ---------- # MAGIC %md # MAGIC #####4. Delete a specific Entity # COMMAND ---------- search = client.search_entities( "databricks://adb-2578185452046759.19.azuredatabricks.net") for page in search: print(page["id"]) delete_response = client.delete_entity(guid=page["id"]) print(json.dumps(delete_response, indent=2))
import time import os import sys import array from pyapacheatlas.auth import ServicePrincipalAuthentication from pyapacheatlas.core import PurviewClient, AtlasEntity, AtlasProcess filename = sys.argv[1] oauth = ServicePrincipalAuthentication( tenant_id=os.environ.get('AZURE_TENANT_ID', ''), client_id=os.environ.get('AZURE_CLIENT_ID', ''), client_secret=os.environ.get('AZURE_CLIENT_SECRET', '')) client = PurviewClient(account_name=os.environ.get('PURVIEW_CATALOG_NAME', ''), authentication=oauth) infile = open(filename) guids = [] for line in infile: guids.append(line.strip()) client.delete_entity(guids) infile.close() os.remove(filename)
"guid": -100, # Ends are either guid or guid + typeName # (in case there are ambiguities?) # End1 is the hive_table "end1": { "guid": assignments["-1"] }, # End2 is the hive_column "end2": { "guid": assignments["-5"] } } relation_upload = client.upload_relationship(relationship) # Check that we have one more relationship print( "Now we can see that there should be one more relationship attribute." ) live_table_post_relationship = client.get_entity( guid=assignments["-1"])["entities"][0] print( json.dumps(live_table_post_relationship["relationshipAttributes"], indent=2)) finally: # Need to delete all columns BEFORE you delete the table for local_id in [str(s) for s in range(-5, 0)]: guid = assignments[local_id] _ = client.delete_entity(guid)
from pyapacheatlas.auth import ServicePrincipalAuthentication from pyapacheatlas.core import PurviewClient # Communicate with your Atlas server if __name__ == "__main__": """ This sample provides an example of deleting an entity through the Atlas API. """ # Authenticate against your Atlas server oauth = ServicePrincipalAuthentication( tenant_id=os.environ.get("TENANT_ID", ""), client_id=os.environ.get("CLIENT_ID", ""), client_secret=os.environ.get("CLIENT_SECRET", "")) client = PurviewClient(account_name=os.environ.get("PURVIEW_NAME", ""), authentication=oauth) # When you know the GUID that you want to delete response = client.delete_entity(guid="123-abc-456-def") print(json.dumps(response, indent=2)) # When you need to find multiple Guids to delete and they all # are the same type entities = client.get_entity( qualifiedName=["qualifiedname1", "qualifiedname2", "qualifiedname3"], typeName="my_type") for entity in entities.get("entities"): guid = entity["guid"] delete_response = client.delete_entity(guid=guid) print(json.dumps(delete_response, indent=2))
from pyapacheatlas.core import PurviewClient # Communicate with your Atlas server if __name__ == "__main__": """ This sample provides an example of deleting an entity through the Atlas API. """ # Authenticate against your Atlas server oauth = ServicePrincipalAuthentication( tenant_id=os.environ.get("TENANT_ID", ""), client_id=os.environ.get("CLIENT_ID", ""), client_secret=os.environ.get("CLIENT_SECRET", "")) client = PurviewClient(account_name=os.environ.get("PURVIEW_NAME", ""), authentication=oauth) # When you know the GUID that you want to delete response = client.delete_entity(guid="123-abc-456-def") print(json.dumps(response, indent=2)) # When you need to find multiple Guids to delete and they all # are the same type entities = client.get_entity( qualifiedName=["qualifiedname1", "qualifiedname2", "qualifiedname3"], typeName="my_type") for entity in entities.get("entities"): response = PurviewClient.delete_entity(guid=entity["guid"]) guid = response["guid"] delete_response = client.delete_entity(guid=guid) print(json.dumps(delete_response, indent=2))