Closed ckunki closed 1 month ago
Currently when using
--/
CREATE OR REPLACE PYTHON3_AAF SET SCRIPT "MY_SCHEMA"."MY_QUERY_HANDLER_UDF"(...)
EMITS (outputs VARCHAR(2000000)) AS
xyz = create_module("xyz", [ExampleQueryHandler, ExampleQueryHandlerFactory])
/
and
EXECUTE SCRIPT MY_SCHEMA.AAF_RUN_QUERY_HANDLER('{
"query_handler": {
"factory_class": {
"module": "xyz",
"name": "ExampleQueryHandlerFactory"
},
I get the error message
udf_framework/query_handler_runner_udf.py", line 215, in _create_state
module = importlib.import_module(self.parameter.python_class_module)
ModuleNotFoundError: No module named 'xyz'
Maybe we need to call create_module()
in query_handler_runner_udf.py?
Now, when using
new_module = DynamicModule("xyz").add(ExampleQueryHandler)
import xyz
class ExampleQueryHandlerFactory:
def create(self, parameter: str, query_handler_context: QueryHandlerContext):
return xyz.ExampleQueryHandler(parameter, query_handler_context)
new_module.add(ExampleQueryHandlerFactory)
... I get the error message
_pickle.PicklingError: Can't pickle <class 'ExampleQueryHandler'>:
it's not found as builtins.ExampleQueryHandler
'" caught in script "MY_SCHEMA"."AAF_RUN_QUERY_HANDLER"
at line 628
I only was successful when using the module builtins
:
new_module = DynamicModule("builtins").add(ExampleQueryHandler)
import builtins
class ExampleQueryHandlerFactory:
def create(self, parameter: str, query_handler_context: QueryHandlerContext):
return builtins.ExampleQueryHandler(parameter, query_handler_context)
new_module.add(ExampleQueryHandlerFactory)
My initial plan included the following tasks
These tasks have now been replaced
Remove sentence
For this the proxy maintains a reference counter.
As this is an irrelevant implementation detail and also not 100% correct in this place
MY_SCHEMA
and TEMP_SCHEMA
)
Factory on the fly
See
Tasks