Hello everyone! Is there any information on how to...
# troubleshoot
h
Hello everyone! Is there any information on how to ingest DatasetProfileClass? Previously I was ingesting everything using information from schema_classes.py, but I can't see a way to ingest Profiles.
m
@handsome-belgium-11927 the secret lies in the MetadataChangeProposalWrapper class. @helpful-optician-78938 can send you a snippet of code that shows you how to use that API.
b
I also would like a snippet! Would like to know how to pass profiles from non sqlalchemy sources
h
I could not find any reference to MetadataChangeProposalWrapper in python, only MetadataChangeProposalClass, and it is not obvious at all how to work with it. Should I use GenericAspectClass for DatasetProfile? I'd be very grateful for code or a hint.
h
Hi @handsome-belgium-11927, here is the template to follow
Copy code
python
from datahub.emitter.mcp import MetadataChangeProposalWrapper
// construct the profile
my_profile = DatasetProfileClass(timestampMillis=..., <rest of the params>)
// keep the first 3 params unchanged
mcp = MetadataChangeProposalWrapper(
            entityType="dataset",
            aspectName="datasetProfile",
            changeType=ChangeTypeClass.UPSERT,
            entityUrn=urn_builder(self.resource),
            aspect=my_profile,
        )
// emit via rest_emitter/ kafka_emitter
my_emitter.emit(item=mcp)
🙌 1
h
It is working, many thanks!
👍 1