Amazon Redshift : UDF
1、Redshift的UDF需要用Python来描述,在Redshift中注册为UDF之前,首先尝试在Python中查找哈希值。$ python>>> import hashlib>>> hashlib.sha256("").hexdigest()'e3b0c44298fc1c149afbf4c
·
1、Redshift的UDF需要用Python来描述,在Redshift中注册为UDF之前,首先尝试在Python中查找哈希值。
$ python
>>> import hashlib
>>> hashlib.sha256("").hexdigest()
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
2、创建一个UDF,SHA256
create function f_sha256 (mes VARCHAR)
returns VARCHAR
stable
as $$
import hashlib
return hashlib.sha256(mes).hexdigest()
$$ language plpythonu;
SHA512同上
请注意“您必须是所有者或超级用户才能替换或删除UDF或库。
更多推荐
已为社区贡献1条内容
所有评论(0)