From b5f8872d6964f6fb9118758d17c04559c81c03bc Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Thu, 10 Aug 2023 12:33:36 -0700 Subject: [PATCH 1/3] fix(ingest): avoid mutable defaults in powerbi dataclass --- .../ingestion/source/powerbi/rest_api_wrapper/data_classes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py b/metadata-ingestion/src/datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py index 2d2d9f527788f7..3fc6c1eaa6cfe9 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py +++ b/metadata-ingestion/src/datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py @@ -1,4 +1,5 @@ from dataclasses import dataclass +import dataclasses from enum import Enum from typing import Any, Dict, List, Optional, Union @@ -105,7 +106,7 @@ class Measure: dataType: str = "measure" datahubDataType: Union[ BooleanTypeClass, DateTypeClass, NullTypeClass, NumberTypeClass, StringTypeClass - ] = NullTypeClass() + ] = dataclasses.field(default_factory=NullTypeClass) description: Optional[str] = None From d14868573401d97ca55a5bdff67c2886facf29a8 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Thu, 10 Aug 2023 12:39:18 -0700 Subject: [PATCH 2/3] registry tweak --- metadata-ingestion/src/datahub/ingestion/api/registry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/ingestion/api/registry.py b/metadata-ingestion/src/datahub/ingestion/api/registry.py index ec4884e7e805f8..56ea716948199e 100644 --- a/metadata-ingestion/src/datahub/ingestion/api/registry.py +++ b/metadata-ingestion/src/datahub/ingestion/api/registry.py @@ -127,7 +127,7 @@ def _ensure_not_lazy(self, key: str) -> Union[Type[T], Exception]: plugin_class = import_path(path) self.register(key, plugin_class, override=True) return plugin_class - except (AssertionError, ImportError) as e: + except Exception as e: self.register_disabled(key, e, override=True) return e From 0d4c62c55ca92bb0527ec739b08354b4ba4c123d Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Thu, 10 Aug 2023 13:24:57 -0700 Subject: [PATCH 3/3] fix import --- .../ingestion/source/powerbi/rest_api_wrapper/data_classes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py b/metadata-ingestion/src/datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py index 3fc6c1eaa6cfe9..0d41ab00c66f5e 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py +++ b/metadata-ingestion/src/datahub/ingestion/source/powerbi/rest_api_wrapper/data_classes.py @@ -1,5 +1,5 @@ -from dataclasses import dataclass import dataclasses +from dataclasses import dataclass from enum import Enum from typing import Any, Dict, List, Optional, Union