从我的 Redshift 存储过程调用 python lambda UDF 时,出现以下错误。知道有什么问题吗?
ERROR: Invalid External Function Response Detail:
-----------------------------------------------
error: Invalid External Function Response code:
8001 context: Extra rows in external function response query: 0
location: exfunc_data.cpp:330 process: padbmaster [pid=8842]
-----------------------------------------------
我的 Python Lambda UDF 如下所示。
def lambda_handler(event, context):
#...
result = DoJob()
#...
ret = dict()
ret['results'] = result
ret_json = json.dumps(ret)
return ret_json
上面的 lambda 函数通过 name 与 Redshift 中的外部函数相关联send_email_lambda。权限和调用没有任何问题。我按如下方式调用 lambda 函数。
select send_email_lambda('sebder@company.com',
'recipient1@company.com',
'sample body',
'sample subject);
编辑:根据要求,添加从 redshift 传递到 lambda 的事件有效负载。
{
"user":"awsuser",
"cluster":"arn:aws:redshift:us-central-1:dummy:cluster:redshift-test-cluster",
"database":"sample",
"external_function":"lambda_send_email",
"query_id":178044,
"request_id":"20211b87-26c8-6d6a-a256-1a8568287feb",
"arguments":[
[
"sender@company.com",
"user1@company.com,user2@company.com",
"<html><h1>Hello Therer</h1><p>A sample email from redshift. Take care and stay safe</p></html>",
"Redshift email lambda UDF",
"None",
"None",
"text/html"
]
],
"num_records":1
}