Hello datahub people, I hope you guys are having g...
# troubleshoot
b
Hello datahub people, I hope you guys are having great Friday - time to ruin it with one more weird question 😄 I wanted to ask if you have some example on how can I use the "AddDatasetProperties" class in order to update a properties for an already existing urn, is there some example on your github page that I can refer to? Thanks for a reply in an advance!
f
@breezy-portugal-43538 You might need implement an (Java/Python) Emitter to push your changes to datahub-gms. https://datahubproject.io/docs/metadata-ingestion/as-a-library Example: this is Python code I just type, install
datahub-rest
package first.
Copy code
from datahub.metadata.schema_classes import (
   ChangeTypeClass
)
import datahub.emitter.mce_builder as builder
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.emitter.rest_emitter import DatahubRestEmitter
from datahub.metadata.com.linkedin.pegasus2avro.dataset import DatasetProperties

new_dataset_properties = DatasetProperties(
    customProperties=None,
    externalUrl='<http://your-url>',
    name='your-name',
    qualifiedName='qualifiedName',
    description='your-description',
    uri='<http://your-uri>',
    tags='custom-tags'
)

mcp = MetadataChangeProposalWrapper(
    entityType="dataset",
    aspectName="datasetProperties",
    changeType=ChangeTypeClass.UPSERT,
    entityUrn=builder.make_dataset_urn_with_platform_instance(
        platform="your-platform",
        name="your-dataset",
        platform="<<optional>>your-instance"
    ),
    aspect=new_dataset_properties,
)

# Create an emitter to the GMS REST API.
emitter = DatahubRestEmitter("<http://localhost:8080>")

# Emit metadata!
emitter.emit_mcp(mcp)
b
thanks a lot!