From 318c76fe1f23710dbd7aa4b6db7bebaab1ef1ed3 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Mon, 22 Jul 2024 15:26:37 -0700 Subject: [PATCH] feat(ingest/looker): include dashboard urns in browse v2 (#10955) --- .../ingestion/source/looker/looker_source.py | 9 ++++----- ...olden_test_external_project_view_mces.json | 3 ++- .../looker/golden_test_file_path_ingest.json | 3 ++- .../golden_test_independent_look_ingest.json | 3 ++- .../looker/golden_test_ingest.json | 3 ++- .../looker/golden_test_ingest_joins.json | 3 ++- .../looker_mces_golden_deleted_stateful.json | 19 ++++++++++--------- 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py index d951a6dbe7a626..cd050fec35c2c7 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py @@ -670,11 +670,12 @@ def _make_chart_metadata_events( ) chart_snapshot.aspects.append(browse_path) + dashboard_urn = self.make_dashboard_urn(dashboard) browse_path_v2 = BrowsePathsV2Class( path=[ BrowsePathEntryClass("Folders"), *self._get_folder_browse_path_v2_entries(dashboard.folder), - BrowsePathEntryClass(id=dashboard.title), + BrowsePathEntryClass(id=dashboard_urn, urn=dashboard_urn), ], ) elif ( @@ -819,7 +820,7 @@ def _make_dashboard_metadata_events( return proposals - def make_dashboard_urn(self, looker_dashboard): + def make_dashboard_urn(self, looker_dashboard: LookerDashboard) -> str: return builder.make_dashboard_urn( self.source_config.platform_name, looker_dashboard.get_urn_dashboard_id() ) @@ -1202,9 +1203,7 @@ def _input_fields_from_dashboard_element( def _make_metrics_dimensions_dashboard_mcp( self, dashboard: LookerDashboard ) -> MetadataChangeProposalWrapper: - dashboard_urn = builder.make_dashboard_urn( - self.source_config.platform_name, dashboard.get_urn_dashboard_id() - ) + dashboard_urn = self.make_dashboard_urn(dashboard) all_fields = [] for dashboard_element in dashboard.dashboard_elements: all_fields.extend( diff --git a/metadata-ingestion/tests/integration/looker/golden_test_external_project_view_mces.json b/metadata-ingestion/tests/integration/looker/golden_test_external_project_view_mces.json index 3f11798d0aa5a4..d893a9bcc50b7b 100644 --- a/metadata-ingestion/tests/integration/looker/golden_test_external_project_view_mces.json +++ b/metadata-ingestion/tests/integration/looker/golden_test_external_project_view_mces.json @@ -175,7 +175,8 @@ "urn": "urn:li:container:691314a7b63628684d62a14861d057a8" }, { - "id": "foo" + "id": "urn:li:dashboard:(looker,dashboards.1)", + "urn": "urn:li:dashboard:(looker,dashboards.1)" } ] } diff --git a/metadata-ingestion/tests/integration/looker/golden_test_file_path_ingest.json b/metadata-ingestion/tests/integration/looker/golden_test_file_path_ingest.json index ec2c46c5daf27a..411005fcb6f054 100644 --- a/metadata-ingestion/tests/integration/looker/golden_test_file_path_ingest.json +++ b/metadata-ingestion/tests/integration/looker/golden_test_file_path_ingest.json @@ -175,7 +175,8 @@ "urn": "urn:li:container:691314a7b63628684d62a14861d057a8" }, { - "id": "foo" + "id": "urn:li:dashboard:(looker,dashboards.1)", + "urn": "urn:li:dashboard:(looker,dashboards.1)" } ] } diff --git a/metadata-ingestion/tests/integration/looker/golden_test_independent_look_ingest.json b/metadata-ingestion/tests/integration/looker/golden_test_independent_look_ingest.json index bb3c3ccb4e2146..6000332b2bf997 100644 --- a/metadata-ingestion/tests/integration/looker/golden_test_independent_look_ingest.json +++ b/metadata-ingestion/tests/integration/looker/golden_test_independent_look_ingest.json @@ -182,7 +182,8 @@ "urn": "urn:li:container:691314a7b63628684d62a14861d057a8" }, { - "id": "foo" + "id": "urn:li:dashboard:(looker,dashboards.1)", + "urn": "urn:li:dashboard:(looker,dashboards.1)" } ] } diff --git a/metadata-ingestion/tests/integration/looker/golden_test_ingest.json b/metadata-ingestion/tests/integration/looker/golden_test_ingest.json index a7b8abed02da31..639e69a6f82059 100644 --- a/metadata-ingestion/tests/integration/looker/golden_test_ingest.json +++ b/metadata-ingestion/tests/integration/looker/golden_test_ingest.json @@ -175,7 +175,8 @@ "urn": "urn:li:container:691314a7b63628684d62a14861d057a8" }, { - "id": "foo" + "id": "urn:li:dashboard:(looker,dashboards.1)", + "urn": "urn:li:dashboard:(looker,dashboards.1)" } ] } diff --git a/metadata-ingestion/tests/integration/looker/golden_test_ingest_joins.json b/metadata-ingestion/tests/integration/looker/golden_test_ingest_joins.json index a1a7747c741a6b..487a18022cb087 100644 --- a/metadata-ingestion/tests/integration/looker/golden_test_ingest_joins.json +++ b/metadata-ingestion/tests/integration/looker/golden_test_ingest_joins.json @@ -175,7 +175,8 @@ "urn": "urn:li:container:691314a7b63628684d62a14861d057a8" }, { - "id": "foo" + "id": "urn:li:dashboard:(looker,dashboards.1)", + "urn": "urn:li:dashboard:(looker,dashboards.1)" } ] } diff --git a/metadata-ingestion/tests/integration/looker/looker_mces_golden_deleted_stateful.json b/metadata-ingestion/tests/integration/looker/looker_mces_golden_deleted_stateful.json index e3cbf43059c7c7..ec5a4f1f801598 100644 --- a/metadata-ingestion/tests/integration/looker/looker_mces_golden_deleted_stateful.json +++ b/metadata-ingestion/tests/integration/looker/looker_mces_golden_deleted_stateful.json @@ -182,7 +182,8 @@ "urn": "urn:li:container:691314a7b63628684d62a14861d057a8" }, { - "id": "foo" + "id": "urn:li:dashboard:(looker,dashboards.1)", + "urn": "urn:li:dashboard:(looker,dashboards.1)" } ] } @@ -807,8 +808,8 @@ } }, { - "entityType": "chart", - "entityUrn": "urn:li:chart:(looker,dashboard_elements.10)", + "entityType": "container", + "entityUrn": "urn:li:container:621eb6e00da9abece0f64522f81be0e7", "changeType": "UPSERT", "aspectName": "status", "aspect": { @@ -824,8 +825,8 @@ } }, { - "entityType": "dashboard", - "entityUrn": "urn:li:dashboard:(looker,dashboards.11)", + "entityType": "dataset", + "entityUrn": "urn:li:dataset:(urn:li:dataPlatform:looker,bogus data.explore.my_view,PROD)", "changeType": "UPSERT", "aspectName": "status", "aspect": { @@ -841,8 +842,8 @@ } }, { - "entityType": "container", - "entityUrn": "urn:li:container:621eb6e00da9abece0f64522f81be0e7", + "entityType": "dashboard", + "entityUrn": "urn:li:dashboard:(looker,dashboards.11)", "changeType": "UPSERT", "aspectName": "status", "aspect": { @@ -858,8 +859,8 @@ } }, { - "entityType": "dataset", - "entityUrn": "urn:li:dataset:(urn:li:dataPlatform:looker,bogus data.explore.my_view,PROD)", + "entityType": "chart", + "entityUrn": "urn:li:chart:(looker,dashboard_elements.10)", "changeType": "UPSERT", "aspectName": "status", "aspect": {