pip install acryl-datahubSynchronizedFileEmitter (debugging) — writes MCPs to a local JSON file instead of a live server; inspect the file, then switch to the REST emitter once the output looks rightentityUrn — the unique identifier for the entity being updatedentityType — the type of entity: dataset, dashboard, dataJob, etc.aspectName — which aspect you are updating: schemaMetadata, datasetProperties, ownership, etc.aspect — the new value of that aspectchangeType — the operation: UPSERT (create or update) or DELETEurn:li:dataset:(urn:li:dataPlatform:PLATFORM,TABLE_NAME,ENV) urn:li:dashboard:(PLATFORM,DASHBOARD_ID) urn:li:corpuser:email@company.comurn:li:dataset:(urn:li:dataPlatform:snowflake,PROD.FINANCE.FACT_REVENUE_DAILY,PROD) , urn:li:dataset:(urn:li:dataPlatform:internaldb,mydb.users,PROD) UpstreamLineage declares that one dataset is derived from another.
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.emitter.rest_emitter import DatahubRestEmitter
from datahub.metadata.schema_classes import (
UpstreamLineageClass, UpstreamClass, DatasetLineageTypeClass
)
upstream_urn = "urn:li:dataset:(urn:li:dataPlatform:snowflake,PROD.CORE.raw_events,PROD)"
downstream_urn = "urn:li:dataset:(urn:li:dataPlatform:internaldb,mydb.aggregated_metrics,PROD)"
lineage_mcp = MetadataChangeProposalWrapper(
entityUrn=downstream_urn,
aspect=UpstreamLineageClass(
upstreams=[UpstreamClass(dataset=upstream_urn, type=DatasetLineageTypeClass.TRANSFORMED)]
),
)
emitter = DatahubRestEmitter("http://localhost:8080")
emitter.emit(lineage_mcp)
datahub check server-config before starting any ingestion script"datahub init (or the DATAHUB_GMS_URL / DATAHUB_GMS_TOKEN env vars)datahub check server-config with the server config printed to output, confirming GMS is reachable and the token is valid.internaldb.users (user_id, email, created_at)internaldb.sessions (session_id, user_id, started_at, duration_seconds)internaldb.events (event_id, session_id, event_type, occurred_at)internaldb.aggregated_metrics (metric_name, metric_value, computed_at) — downstream of snowflake.PROD.CORE.raw_eventsinternaldb.revenue_summary (period, revenue, region) — downstream of snowflake.PROD.FINANCE.raw_revenueurn:li:dataset:(urn:li:dataPlatform:PLATFORM,TABLE_NAME,ENV)