From 5288e1f96fd4a88b778126e41259400920794fc1 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Fri, 19 Jul 2024 12:38:34 -0700 Subject: [PATCH 1/2] feat(ingest/looker): include dashboard urns in browse v2 --- .../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 d951a6dbe7a62..2116e6867d512 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): 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 3f11798d0aa5a..d893a9bcc50b7 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 ec2c46c5daf27..411005fcb6f05 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 bb3c3ccb4e214..6000332b2bf99 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 a7b8abed02da3..639e69a6f8205 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 a1a7747c741a6..487a18022cb08 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 e3cbf43059c7c..ec5a4f1f80159 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": { From fbb30674e243bfee4b1f9a6da3466a723da879c9 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Fri, 19 Jul 2024 13:06:02 -0700 Subject: [PATCH 2/2] fix lint --- .../src/datahub/ingestion/source/looker/looker_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 2116e6867d512..cd050fec35c2c 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py @@ -820,7 +820,7 @@ def _make_dashboard_metadata_events( return proposals - def make_dashboard_urn(self, looker_dashboard: LookerDashboard): + 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() )