3

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

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Welcome to SO. It is better to place a full answer here instead of links. If the link stops working, the answer is lost.
Thanks for your comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.