Title
f

fierce-airplane-70308

02/23/2022, 10:29 PM
I'm trying to create lineage between a (Custom) Qlik dashboard and 2 datasets but i just get an internal error. Are there any examples using python emitter to establish lineage between datasets and dashboard?
from typing import List

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 (
    DatasetLineageTypeClass,
    UpstreamClass,
    UpstreamLineage,
)
from datahub.metadata.schema_classes import ChangeTypeClass

# Construct upstream tables.
upstream_tables: List[UpstreamClass] = []
upstream_table_1 = UpstreamClass(
    dataset=builder.make_dataset_urn("mssql", "Analytics.PDDBI_DL.USERS","PROD"),
    type=DatasetLineageTypeClass.TRANSFORMED,
)
upstream_tables.append(upstream_table_1)
upstream_table_2 = UpstreamClass(
    dataset=builder.make_dataset_urn("mssql", "<http://Analytics.PDDBI_DL.JOBS|Analytics.PDDBI_DL.JOBS>","PROD"),
    type=DatasetLineageTypeClass.TRANSFORMED,
)
upstream_tables.append(upstream_table_2)

# Construct a lineage object.
upstream_lineage = UpstreamLineage(upstreams=upstream_tables)

# Construct a MetadataChangeProposalWrapper object.
lineage_mcp = MetadataChangeProposalWrapper(
    entityType="dataset",
    changeType=ChangeTypeClass.UPSERT,
    entityUrn=builder.make_dashboard_urn(platform="QlikSense", name="14542bf2-65a8-46ee-b140-953a2f67ebee"),
    aspectName="upstreamLineage",
    aspect=upstream_lineage,
)

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

# Emit metadata!
emitter.emit_mcp(lineage_mcp)
One thing to note, I already have dataset to dataset lineage imported
e

early-lamp-41924

02/24/2022, 5:42 AM
Hey! So you can’t link dashboards with datasets, but you can link charts with datasets. If in Qlik there is no concept of charts vs dashboard, I would suggest creating a dummy chart entity inside the dashboard.
Unfortunatly, the field for setting inputs is ^ inside the ChartInfo object, so you will have to first fetch the ChartInfo object for the given urn, update the inputs field (by adding the upstream dataset) and ingest the object.
f

fierce-airplane-70308

02/24/2022, 5:51 AM
Ok thanks that is helpful information!