I am trying to create Python UDF in Amazon Redshift, and I have successfully created the UDF with no error. I have also created the required library for this UDF successfully. But when I execute the UDF, I get the error:
No Module Named pyffx. Please look at svl_udf_log for more information
I have downloaded the library from pypi.org
and uploaded it to Amazon S3. This is the link I used to download the library:
https://pypi.org/project/pyffx/#files
create library pyffx
language plpythonu
from 's3://aws-bucket/tmp/python_module/pyffx-0.3.0.zip'
credentials
'aws_iam_role=iam role'
region 'us-east-1';
CREATE OR REPLACE FUNCTION schema.ffx(src VARCHAR)
RETURNS VARCHAR
STABLE
AS $$
import pyffx
src = unicode(src)
value=(src)
l=len(value)
e = pyffx.String(b'secret-key', alphabet='abcedefghijklmnopqrstuvwxyz123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', length=l)
return e.encrypt(value)
$$ LANGUAGE plpythonu;