diff --git a/metadata-ingestion/src/datahub/ingestion/source/metabase.py b/metadata-ingestion/src/datahub/ingestion/source/metabase.py index 01396c8bba8209..2b0ea4c1f51f62 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/metabase.py +++ b/metadata-ingestion/src/datahub/ingestion/source/metabase.py @@ -313,7 +313,7 @@ def construct_dashboard_from_api_data( return None dashboard_urn = builder.make_dashboard_urn( - self.platform, dashboard_details.get("id", "") + self.platform, str(dashboard_details.get("id", "")) ) dashboard_snapshot = DashboardSnapshot( urn=dashboard_urn, @@ -337,7 +337,7 @@ def construct_dashboard_from_api_data( card_id = card_info.get("card").get("id", "") if not card_id: continue # most likely a virtual card without an id (text or heading), not relevant. - chart_urn = builder.make_chart_urn(self.platform, card_id) + chart_urn = builder.make_chart_urn(self.platform, str(card_id)) chart_urns.append(chart_urn) dashboard_info_class = DashboardInfoClass( @@ -459,7 +459,7 @@ def construct_card_from_api_data(self, card_data: dict) -> Optional[ChartSnapsho ) return None - chart_urn = builder.make_chart_urn(self.platform, card_id) + chart_urn = builder.make_chart_urn(self.platform, str(card_id)) chart_snapshot = ChartSnapshot( urn=chart_urn, aspects=[], diff --git a/metadata-ingestion/src/datahub/ingestion/source/mode.py b/metadata-ingestion/src/datahub/ingestion/source/mode.py index 2e7a77eae4e2a6..dd62144a8fa9d4 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/mode.py +++ b/metadata-ingestion/src/datahub/ingestion/source/mode.py @@ -377,7 +377,7 @@ def _browse_path_chart( ] def _dashboard_urn(self, report_info: dict) -> str: - return builder.make_dashboard_urn(self.platform, report_info.get("id", "")) + return builder.make_dashboard_urn(self.platform, str(report_info.get("id", ""))) def _parse_last_run_at(self, report_info: dict) -> Optional[int]: # Mode queries are refreshed, and that timestamp is reflected correctly here. diff --git a/metadata-ingestion/tests/unit/sdk/test_mce_builder.py b/metadata-ingestion/tests/unit/sdk/test_mce_builder.py index 45122926de89b9..9e1e78d17efac2 100644 --- a/metadata-ingestion/tests/unit/sdk/test_mce_builder.py +++ b/metadata-ingestion/tests/unit/sdk/test_mce_builder.py @@ -91,6 +91,13 @@ def test_create_urns_with_reserved_chars() -> None: ) == "urn:li:dashboard:(platform%%28%29%2C%E2%90%9F,platform-instance%%28%29%2C%E2%90%9F.dashboard%%28%29%2C%E2%90%9F)" ) + assert ( + builder.make_dashboard_urn( + platform=f"platform{_RESERVED_CHARS_STRING}", + name=f"dashboard{_RESERVED_CHARS_STRING}", + ) + == "urn:li:dashboard:(platform%%28%29%2C%E2%90%9F,dashboard%%28%29%2C%E2%90%9F)" + ) assert ( builder.make_chart_urn( platform=f"platform{_RESERVED_CHARS_STRING}", @@ -99,6 +106,13 @@ def test_create_urns_with_reserved_chars() -> None: ) == "urn:li:chart:(platform%%28%29%2C%E2%90%9F,platform-instance%%28%29%2C%E2%90%9F.dashboard%%28%29%2C%E2%90%9F)" ) + assert ( + builder.make_chart_urn( + platform=f"platform{_RESERVED_CHARS_STRING}", + name=f"dashboard{_RESERVED_CHARS_STRING}", + ) + == "urn:li:chart:(platform%%28%29%2C%E2%90%9F,dashboard%%28%29%2C%E2%90%9F)" + ) def test_make_user_urn() -> None: