From 74f155cd7180627605000ba69a2626585ca99a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=9F=8E?= Date: Wed, 30 Nov 2022 20:23:19 +0800 Subject: [PATCH 1/3] update card_id key --- metadata-ingestion/src/datahub/ingestion/source/metabase.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/metabase.py b/metadata-ingestion/src/datahub/ingestion/source/metabase.py index c847505a7e6ae3..ed550e6bb9999a 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/metabase.py +++ b/metadata-ingestion/src/datahub/ingestion/source/metabase.py @@ -245,7 +245,7 @@ def construct_dashboard_from_api_data( chart_urns = [] cards_data = dashboard_details.get("ordered_cards", "{}") for card_info in cards_data: - chart_urn = builder.make_chart_urn(self.platform, card_info.get("id", "")) + chart_urn = builder.make_chart_urn(self.platform, card_info.get("card_id", "")) chart_urns.append(chart_urn) dashboard_info_class = DashboardInfoClass( @@ -315,7 +315,7 @@ def emit_card_mces(self) -> Iterable[MetadataWorkUnit]: return None def construct_card_from_api_data(self, card_data: dict) -> Optional[ChartSnapshot]: - card_id = card_data.get("id", "") + card_id = card_data.get("card_id", "") card_url = f"{self.config.connect_uri}/api/card/{card_id}" try: card_response = self.session.get(card_url) @@ -345,7 +345,7 @@ def construct_card_from_api_data(self, card_data: dict) -> Optional[ChartSnapsho ) chart_type = self._get_chart_type( - card_details.get("id", ""), card_details.get("display") + card_id, card_details.get("display") ) description = card_details.get("description") or "" title = card_details.get("name") or "" From f954ddec568ee3cef4b62b0aeb9178988b78bd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=9F=8E?= Date: Thu, 1 Dec 2022 17:50:16 +0800 Subject: [PATCH 2/3] update card_id key --- metadata-ingestion/src/datahub/ingestion/source/metabase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/metabase.py b/metadata-ingestion/src/datahub/ingestion/source/metabase.py index ed550e6bb9999a..2c40f603e07d78 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/metabase.py +++ b/metadata-ingestion/src/datahub/ingestion/source/metabase.py @@ -315,7 +315,7 @@ def emit_card_mces(self) -> Iterable[MetadataWorkUnit]: return None def construct_card_from_api_data(self, card_data: dict) -> Optional[ChartSnapshot]: - card_id = card_data.get("card_id", "") + card_id = card_data.get("id", "") card_url = f"{self.config.connect_uri}/api/card/{card_id}" try: card_response = self.session.get(card_url) From 328f600ac65ec9f35a639b0ecdac09a3cf4f65d1 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Fri, 30 Dec 2022 15:33:41 -0500 Subject: [PATCH 3/3] lint fix --- .../src/datahub/ingestion/source/metabase.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/metabase.py b/metadata-ingestion/src/datahub/ingestion/source/metabase.py index a9f9f8bfc718a1..8d111f72f79ce5 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/metabase.py +++ b/metadata-ingestion/src/datahub/ingestion/source/metabase.py @@ -244,7 +244,9 @@ def construct_dashboard_from_api_data( chart_urns = [] cards_data = dashboard_details.get("ordered_cards", "{}") for card_info in cards_data: - chart_urn = builder.make_chart_urn(self.platform, card_info.get("card_id", "")) + chart_urn = builder.make_chart_urn( + self.platform, card_info.get("card_id", "") + ) chart_urns.append(chart_urn) dashboard_info_class = DashboardInfoClass( @@ -343,9 +345,7 @@ def construct_card_from_api_data(self, card_data: dict) -> Optional[ChartSnapsho lastModified=AuditStamp(time=modified_ts, actor=modified_actor), ) - chart_type = self._get_chart_type( - card_id, card_details.get("display") - ) + chart_type = self._get_chart_type(card_id, card_details.get("display")) description = card_details.get("description") or "" title = card_details.get("name") or "" datasource_urn = self.get_datasource_urn(card_details)