【发布时间】:2019-03-07 03:14:58
【问题描述】:
我正在尝试在 redshift 中实现嵌套的 udf。
select
custom_function(custom_function('', column1), column2)
from
table1
但它说不支持嵌套的 udf。有人可以帮我吗?
尝试使用答案中提到的python库方法,如下所示!!
class f_string:
def __init__(self, current_value, key, value):
self.current_value = current_value
self.key = key
self.value = value
def f_make_json(self):
import json
current_value = json.loads(self.current_value)
self.value.replace('"', '\"')
current_value[self.key] = self.value
return (json.dumps(current_value))
【问题讨论】:
标签: python-3.x amazon-redshift user-defined-functions