redshift开发需要使用python代码来实现具体功能,下面是一个hmac_sha256加密算法的实现:
create or replace function encrypt_kms (mes VARCHAR) returns VARCHAR
stable as $$
import hmac
import hashlib
secretkey=''
message=mes.encode('utf-8')
return hmac.new(secretkey.encode('utf-8'), message, digestmod=hashlib.sha256).hexdigest()
$$ language plpythonu;
之后在客户端执行即可