Hi everybody. I want to create a container using t...
# ingestion
h
Hi everybody. I want to create a container using the python emitter via the rest APIs and unfortunately when I run:
Copy code
import datahub.emitter.mce_builder as builder
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.metadata.schema_classes import ChangeTypeClass, ContainerPropertiesClass

from datahub.emitter.rest_emitter import DatahubRestEmitter


emitter = DatahubRestEmitter(gms_server="<http://localhost:8080>", extra_headers={})
emitter.test_connection()


metadata_event = MetadataChangeProposalWrapper(
    aspect=ContainerPropertiesClass(
        name="DataProduct1",
        description="original description for dp1"
    ),
    entityType="container",
    changeType=ChangeTypeClass.UPSERT,
    entityUrn="urn:li:container:DATAPROD",
    aspectName="containerProperties",
)

# Emit metadata! This is a blocking call
emitter.emit(metadata_event)
I receive:
The field at path '/search/searchResults[0]/entity' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'Entity' within parent type 'SearchResult' (code undefined)
To be mentioned is that I have created the container before ingesting any data.
g
Hey @high-toothbrush-90528! A few things: 1. this is due to the container not having a data platform instance aspect attached to it. you’ll also want to ingest the DataPlatformInstanceClass aspect with your container. Adding that will resolve your issue 🙂 2. At the same time, we recognize that we should have a better fallback than returning
null
in this case. @big-carpet-38439 is going to submit a PR to have the container fallback to a default data platform instance in the case one is not set.