Hello Team, we are wondering that is there anyway ...
# ingestion
g
Hello Team, we are wondering that is there anyway to Add Documentation for dataset by using Python script (like Python Emitter) ?
b
you can refer to this file in the repo: https://github.com/linkedin/datahub/blob/master/metadata-ingestion/examples/mce_files/bootstrap_mce.json and look for line158, there is an aspect that deals with adding urls.
b
Yes there is! You'd have to update the "description" field of the DatasetProperties aspect using the Python Emitter API
Something like this:
Copy code
# Construct a dataset properties object.
dataset_properties = DatasetProperties(description="My new description", properties={..custom properties})

# Construct a MetadataChangeProposalWrapper object.
properties_mcp = MetadataChangeProposalWrapper(
    entityType="dataset",
    changeType=ChangeTypeClass.UPSERT,
    entityUrn=builder.make_dataset_urn("bigquery", "my-bigquery-table-id"),
    aspectName="datasetProperties",
    aspect=dataset_properties,
)
b
@big-carpet-38439, this actually overwrites all the existing properties. Looks like the UPSERT is for the whole ‘datasetProperties’ aspects and not for individual property key. Is there a way to individually update a property value ? Also do you know how I can read existing properties as a key/value pair ?
g
I wonder if we have a solution for that already 😄 I mean, not overwrite the entire
datasetProperties
, but rather append a new key or update an existing key.