sticky-twilight-17476
06/15/2022, 7:09 AMambitious-piano-33685
06/15/2022, 8:20 AMsticky-twilight-17476
06/15/2022, 10:32 AMambitious-piano-33685
06/15/2022, 10:53 AMambitious-piano-33685
06/15/2022, 10:56 AMsticky-twilight-17476
06/16/2022, 6:49 AMeager-australia-69729
07/13/2022, 3:12 AMbetter-orange-49102
07/14/2022, 8:47 AMeager-australia-69729
07/14/2022, 9:26 AMbetter-orange-49102
07/14/2022, 9:34 AMfrom datahub.emitter.mcp import MetadataChangeProposalWrapper
# read-modify-write requires access to the DataHubGraph (RestEmitter is not enough)
from datahub.ingestion.graph.client import DatahubClientConfig, DataHubGraph
from datahub.metadata.schema_classes import (
ChangeTypeClass,
GlossaryTermInfoClass,
)
gms_endpoint = "<http://localhost:8080>"
token = "xx"
graph = DataHubGraph(DatahubClientConfig(server=gms_endpoint, token=token))
termUrn = f"specifyyourownurn"
mcp = MetadataChangeProposalWrapper(
entityType="glossaryTerm",
changeType=ChangeTypeClass.UPSERT,
entityUrn=termUrn,
aspectName="glossaryTermInfo",
aspect=GlossaryTermInfoClass(
definition=f"description",
name=f"Name of term",
termSource="INTERNAL",
customProperties={"prop1":"value1"}
),
)
graph.emit(mcp)
to update the properties for an existing term, you can use the datahub graph query for the existing term, then insert the properties into it and emit it back. there are examples in metadata-ingestion/examples/libraryeager-australia-69729
07/14/2022, 11:34 PMsticky-twilight-17476
07/15/2022, 12:53 PMsticky-twilight-17476
07/15/2022, 12:54 PMsticky-twilight-17476
07/15/2022, 12:56 PMeager-australia-69729
07/18/2022, 2:36 AMfresh-cricket-75926
02/14/2023, 11:48 AM