I have imported the fuzzywuzzy library on Redshift from S3. I am trying to create the below function:
CREATE OR REPLACE FUNCTION fuzzy_test (string_a TEXT,string_b TEXT) RETURNS FLOAT IMMUTABLE
AS
$$
FROM fuzzywuzzy import fuzz
RETURN fuzz.ratio (string_a,string_b)
$$ LANGUAGE plpythonu;
But this is throwing an error:
[Amazon](500310) Invalid operation: Failed to compile udf
Details:
-----------------------------------------------
error: Failed to compile udf
code: 10000
context: File "/rds/bin/padb.1.0.22169/data/udf/231/978476007/e3afd7ea37e0384bcaf415f60955b5eb6911e3ae/0.py", line 2
FROM fuzzywuzzy import fuzz fz = fuzz()
^
SyntaxError: invalid syntax
query: 0
location: cg_addins.cpp:257
process: padbmaster [pid=4211]
-----------------------------------------------; [SQL State=XX000, DB Errorcode=500310]
1 statement failed.
Please explain me what causing the error.