redshift中的python udf-支持嵌套udf

时间:2018-10-02 01:10:21

标签: python-3.x amazon-redshift user-defined-functions

我正在尝试在redshift中实现嵌套的udf。

select 
     custom_function(custom_function('', column1), column2) 
from 
     table1 

但是它说不支持嵌套udfs。有人可以帮我吗?

尝试使用答案中提到的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))

1 个答案:

答案 0 :(得分:0)

您必须将要嵌套的UDF组织为Python库并将该库导入集群,这里是instruction

相关问题