Hi,
there seems to be a limitation for Python-based loader functions wrt timestamps.
Looking at the implementation in sql/backends/monet5/UDF/pyapi3/convert_loops.h suggests that timestamps are indeed not covered.
Both of the the 2 following examples fail with "Failed conversion: MALException:pyapi3.eval:PY000!Unrecognized type. Could not convert to NPY_UNICODE.".
CREATE LOADER array_loader() LANGUAGE PYTHON {
from datetime import datetime
_emit.emit( { 'a': [1,2,3], 'b': [datetime.utcnow(), datetime.utcnow(), datetime.utcnow()], 'c': ['1', '2', '3']})
};
CREATE LOADER array_loader() LANGUAGE PYTHON {
import numpy as np
from datetime import datetime
dt = datetime.utcnow()
_emit.emit( { 'a': [1,2,3], 'b': np.array([dt, dt, dt], dtype=np.datetime64), 'c': ['1', '2', '3']})
};
Is anyone aware of a workaround? An obvious workaround is to insert the timestamps as strings and convert them via SQL but that's much less efficient.
Kind regards,
Daniel