Skip to content

Commit

Permalink
fix(ingest/mode): Adding Dashboards into containers (#10563)
Browse files Browse the repository at this point in the history
  • Loading branch information
treff7es authored May 22, 2024
1 parent ebb95b8 commit f831518
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
11 changes: 10 additions & 1 deletion metadata-ingestion/src/datahub/ingestion/source/mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
from datahub.configuration.common import AllowDenyPattern, ConfigModel
from datahub.configuration.source_common import DatasetLineageProviderConfigBase
from datahub.emitter.mcp import MetadataChangeProposalWrapper
from datahub.emitter.mcp_builder import ContainerKey, gen_containers
from datahub.emitter.mcp_builder import (
ContainerKey,
add_dataset_to_container,
gen_containers,
)
from datahub.ingestion.api.common import PipelineContext
from datahub.ingestion.api.decorators import (
SourceCapability,
Expand Down Expand Up @@ -1438,6 +1442,7 @@ def construct_space_container(
def emit_dashboard_mces(self) -> Iterable[MetadataWorkUnit]:
for space_token, space_name in self.space_tokens.items():
yield from self.construct_space_container(space_token, space_name)
space_container_key = self.gen_space_key(space_token)

reports = self._get_reports(space_token)
for report in reports:
Expand All @@ -1464,6 +1469,10 @@ def emit_dashboard_mces(self) -> Iterable[MetadataWorkUnit]:
aspect=SubTypesClass(typeNames=[BIAssetSubTypes.MODE_REPORT]),
)
yield mcpw.as_workunit()
yield from add_dataset_to_container(
container_key=space_container_key,
dataset_urn=dashboard_snapshot_from_report.urn,
)
yield browse_mcpw.as_workunit()

usage_statistics = DashboardUsageStatisticsClass(
Expand Down
16 changes: 16 additions & 0 deletions metadata-ingestion/tests/integration/mode/mode_mces_golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "dashboard",
"entityUrn": "urn:li:dashboard:(mode,2934237)",
"changeType": "UPSERT",
"aspectName": "container",
"aspect": {
"json": {
"container": "urn:li:container:800cfcb4cec6ad587cafde11a0b0bb4a"
}
},
"systemMetadata": {
"lastObserved": 1638860400000,
"runId": "mode-test",
"lastRunId": "no-run-id-provided"
}
},
{
"entityType": "dashboard",
"entityUrn": "urn:li:dashboard:(mode,2934237)",
Expand Down

0 comments on commit f831518

Please sign in to comment.