datahub/metadata-ingestion/examples/library/dataset_remove_owner_execute_graphql.py

23 lines
715 B
Python
Raw Permalink Normal View History

# read-modify-write requires access to the DataHubGraph (RestEmitter is not enough)
from datahub.ingestion.graph.client import DatahubClientConfig, DataHubGraph
gms_endpoint = "http://localhost:8080"
graph = DataHubGraph(DatahubClientConfig(server=gms_endpoint))
# Query multiple aspects from entity
query = """
mutation batchRemoveOwners {
batchRemoveOwners(
input: {
ownerUrns: ["urn:li:corpuser:jdoe"],
resources: [
{ resourceUrn:"urn:li:dataset:(urn:li:dataPlatform:hdfs,SampleHdfsDataset,PROD)"} ,
{ resourceUrn:"urn:li:dataset:(urn:li:dataPlatform:hive,fct_users_created,PROD)"} ,]
}
)
}
"""
result = graph.execute_graphql(query=query)
print(result)