How I can execute a select query in AWS Redshift UDF using plpythonu like oracle function with select into class in function like below.
CREATE OR REPLACE FUNCTION udf(id varchar(50))
RETURNS VARCHAR(50)
STABLE
AS $$
result = plpy.execute("SELECT count(*) FROM abc")
return result
$$ LANGUAGE plpythonu;
when I run above function i got following error.
ERROR: XX000: NameError: global name 'plpy' is not defined. Please look at svl_udf_log for more information
It's available on Postgresql (https://www.postgresql.org/docs/9.2/static/plpython-database.html).
At present, Amazon Redshift is not supported.
Same question like yours on this url: https://blogs.aws.amazon.com/bigdata/post/Tx1IHV1G67CY53T/Introduction-to-Python-UDFs-in-Amazon-Redshift
python aws amazon-redshift
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With