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 5
5
from __future__ import annotations
6
6
7
7
import datetime
8
+ import importlib
8
9
import inspect
9
10
import re
10
11
import sys
@@ -1180,14 +1181,17 @@ def _get_class_from_fully_qualified_class_name(
1180
1181
module_name_full = "." .join (split [:- 1 ])
1181
1182
class_name = split [- 1 ]
1182
1183
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
1186
1188
1187
1189
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
1191
1195
1192
1196
@staticmethod
1193
1197
def _derive_component_type_from_type_hints (field_type : Any ) -> Optional [str ]:
You can’t perform that action at this time.
0 commit comments