Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use select query in aws redshift python udf function

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
like image 601
Vijay Avatar asked Sep 26 '26 07:09

Vijay


1 Answers

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

like image 75
Tran Tuyen Avatar answered Sep 27 '26 19:09

Tran Tuyen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!