File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
airbyte_cdk/sources/declarative/parsers Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 55from __future__ import annotations
66
77import datetime
8+ import importlib
89import inspect
910import re
1011import sys
@@ -1180,14 +1181,17 @@ def _get_class_from_fully_qualified_class_name(
11801181 module_name_full = "." .join (split [:- 1 ])
11811182 class_name = split [- 1 ]
11821183
1183- if module_name_full == COMPONENTS_MODULE_NAME :
1184- # Assume "components" on its own means "source_declarative_manifest.components"
1185- module_name_full = SDM_COMPONENTS_MODULE_NAME
1184+ try :
1185+ module_ref = importlib .import_module (module_name_full )
1186+ except ModuleNotFoundError as e :
1187+ raise ValueError (f"Could not load module `{ module_name_full } `." ) from e
11861188
11871189 try :
1188- return getattr (sys .modules [module_name_full ], class_name )
1189- except (AttributeError , ModuleNotFoundError ) as e :
1190- raise ValueError (f"Could not load class { full_qualified_class_name } ." ) from e
1190+ return getattr (module_ref , class_name )
1191+ except AttributeError as e :
1192+ raise ValueError (
1193+ f"Could not load class `{ class_name } ` from module `{ module_name_full } `." ,
1194+ ) from e
11911195
11921196 @staticmethod
11931197 def _derive_component_type_from_type_hints (field_type : Any ) -> Optional [str ]:
You can’t perform that action at this time.
0 commit comments