2016-05-31 9 views
1

Wie kann ich eine Select-Abfrage in AWS Redshift UDF mit plpythonu wie Oracle-Funktion mit Select in Klasse in Funktion wie unten ausführen.Kann ich Select-Abfrage in AWS Redshift Python UDF Funktion

CREATE OR REPLACE FUNCTION udf(id varchar(50)) 
RETURNS VARCHAR(50) 
STABLE 
AS $$ 
    result = plpy.execute("SELECT count(*) FROM abc") 
    return result 
$$ LANGUAGE plpythonu; 

, wenn ich oben Funktion ausführen bekam ich Fehler folgen.

ERROR: XX000: NameError: global name 'plpy' is not defined. Please look at svl_udf_log for more information 

Antwort

1

Es ist auf Postgresql (https://www.postgresql.org/docs/9.2/static/plpython-database.html) verfügbar.

Gegenwärtig wird Amazon Redshift nicht unterstützt.

Gleiche Frage wie du auf diese URL: https://blogs.aws.amazon.com/bigdata/post/Tx1IHV1G67CY53T/Introduction-to-Python-UDFs-in-Amazon-Redshift

+1

Willkommen bei SO. Es ist besser, hier eine vollständige Antwort anstelle von Links zu platzieren. Wenn die Verbindung nicht mehr funktioniert, ist die Antwort verloren. –

+0

Danke für Ihren Kommentar –

Verwandte Themen