Hi! Can someone provide an example how to add prop...
# advice-metadata-modeling
l
Hi! Can someone provide an example how to add properties to Glossary Term using REST API?
i
@limited-motherboard-51317 Its not rest but I used the below code to create a glossary term and add custom properties to it from datahub.emitter.mcp import MetadataChangeProposalWrapper from datahub.metadata.schema_classes import ( ChangeTypeClass, GlossaryTermInfoClass, ) mcp = MetadataChangeProposalWrapper( entityType="glossaryTerm", changeType=ChangeTypeClass.UPSERT, entityUrn=''urn_of_your_term', aspectName="glossaryTermInfo", aspect=GlossaryTermInfoClass( definition=f"description", name="name of your term", parentNode="urnliglossaryNode:xyz", termSource="INTERNAL", customProperties={"key": "value"}, ), ) graph.emit(mcp)
thank you 1
l
Hi! Thank you for great code snippet!
@incalculable-park-61483 BTW do you know where to find Python SDK doc? Where all classes and methods you use are documented? At the moment I'm struggling to find everything in source code of Datahub. And eg schema_classes are not there as they are, I assume, generated
r
hey @limited-motherboard-51317! here are those docs on the python SDK which should help you out with getting yourself set up and ready to go there: https://datahubproject.io/docs/metadata-ingestion/as-a-library/
also here's an additional guide on using the REST api if you're interested in that: https://datahubproject.io/docs/api/restli/restli-overview/
l
@bulky-soccer-26729 Thank you very much for links, will study it