這裏我試圖在紅移導入用戶在紅移UDF定義庫
導入我的用戶定義的Python函數內的圖書館中,我創建了一個稱爲NLTK的庫如下
[CREATE OR REPLACE LIBRARY nltk LANGUAGE plpythonu FROM 's3://nltk.zip' CREDENTIALS 'aws_access_key_id=*****;aws_secret_access_key=****';]
創建一次我試着在函數的輸入這是
CREATE OR REPLACE FUNCTION f_function (sentence varchar)
RETURNS VARCHAR STABLE AS $$
from nltk import tokenize
token = nltk.word_tokenize(sentence)
return token $$ LANGUAGE plpythonu;
記號化是NLTK庫中一個子目錄
但是當我嘗試通過調用它放在一個表作爲
SELECT f_function(text) from table_txt;
我得到一個錯誤運行等功能
Amazon Invalid operation: ImportError: No module named nltk. Please look at svl_udf_log for more information
Details:
-----------------------------------------------
error: ImportError: No module named nltk. Please look at svl_udf_log for more information
code: 10000
context: UDF
query: 69145
location: udf_client.cpp:298
process: query0_21 [pid=3165]
誰能幫我我在哪裏做錯了?
你使用nltk進入redshift嗎? –