most-pillow-90882
04/15/2022, 7:11 AMnamespace com.oxygen
@Aspect = {
"name": "customUniverse",
"autoRender": true,
"renderSpec": {
"displayType": "properties", // or tabular
"key": "universe",
"displayName": "Universe"
}
}
record Universe {
@Searchable = {
"fieldType": "KEYWORD",
"enableAutocomplete": true
"addToFilters": true,
"filterNameOverride": "Universe"
}
universe: string
}
This successfully builds and was added to Datahub
"models": {
"custom-oxygen-model": {
"0.0.3": {
"loadResult": "SUCCESS",
"registryLocation": "/etc/datahub/plugins/models/custom-oxygen-model/0.0.3",
"failureCount": 0
}
},
I now want to use the python emitter to add a value to this aspect
mcp=MetadataChangeProposalWrapper(
entityType="dataset",
entityUrn=dataset_urn,
aspectName="customUniverse",
aspect={"universe": "HELLO WORLD"},
changeType=ChangeTypeClass.UPSERT,
)
)
If I were using an existing aspect, I would import a class from datahub.metadata.schema_classes to wrap around the aspect data. Just trying to send it in a dictionary allows me to create the workunit, but fails when I try to emit: AttributeError: 'dict' object has no attribute 'to_obj'
How should I be using the python emitter with their custom aspects?mammoth-bear-12532
dict
that you are trying to send over to DataHub over REST, you can use the MetadataChangeProposalClass
directly. Here is a gist that shows you how to do it: https://gist.github.com/shirshanka/7bb6889947f4004eaaba0e35675a56dfmost-pillow-90882
04/16/2022, 7:52 PMGenericAspectClass