Hi All,
I am trying to return an "empty" result set from an embedded python
function (as in some situations I will not have valid rows to produce in
the output). However the very many attempts of trying to return an "empty"
result from the function have failed (as is documented in the example
below).
How do you get it done ?
Thanks.
DROP FUNCTION p_results_exp01;
CREATE FUNCTION p_results_exp01() RETURNS TABLE(val1 STRING, val2 INTEGER)
LANGUAGE PYTHON
{
#Unsupported result object. Expected either a list, dictionary, a numpy
array, a numpy masked array or a pandas data frame, but received an object
of type ""
#return None; #Errors
#Expected a return value with name "val1", but this key was not present
in the dictionary.
#return {}; #Errors
#Error converting dict return value "val1":
MALException:pyapi.eval:Unsupported
result object. Expected either a list, dictionary, a numpy array, a numpy
masked array or a pandas data frame, but received an object of type "".
#return {'val1':None, 'val2':None}; #Errors
#Error converting dict return value "val1": MALException:pyapi.eval:An
array of size 0 was returned, yet we expect a list of 1 columns. The result
is invalid..
#return {'val1':[], 'val2':[]};
#return {'val1':['value_1'], 'val2':[1]}; #Works, as it has value.
};
SELECT * FROM p_results_exp01();
Joseph