Amazon Data Pipeline:如何在 SqlActivity 中使用脚本参数? [英] Amazon Data Pipeline: How to use a script argument in a SqlActivity?

查看:22
本文介绍了Amazon Data Pipeline:如何在 SqlActivity 中使用脚本参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在 sqlActivity 中使用脚本参数时:

When trying to use a Script Argument in the sqlActivity:

 {
"id" : "ActivityId_3zboU",
  "schedule" : { "ref" : "DefaultSchedule" },
  "scriptUri" : "s3://location_of_script/unload.sql",
  "name" : "unload",
  "runsOn" : { "ref" : "Ec2Instance" },
  "scriptArgument" : [ "'s3://location_of_unload/#format(minusDays(@scheduledStartTime,1),'YYYY/MM/dd/hhmm/')}'", "'aws_access_key_id=????;aws_secret_access_key=*******'" ],
  "type" : "SqlActivity",
  "dependsOn" : { "ref" : "ActivityId_YY69k" },
  "database" : { "ref" : "RedshiftCluster" }
}

其中 unload.sql 脚本包含:

where the unload.sql script contains:

 unload ('
    select *
    from tbl1 
 ')  
 to ?
 credentials  ?
 delimiter ',' GZIP;

或:

 unload ('
    select *
    from tbl1 
 ')  
 to ?::VARCHAR(255)
 credentials  ?::VARCHAR(255) 
 delimiter ',' GZIP;

进程失败:

syntax error at or near "$1" Position

知道我做错了什么吗?

推荐答案

我相信您正在将这个 sql 活动用于 Redshift.您能否修改您的 sql 脚本以使用它们的位置符号来引用参数.引用sql语句本身中的参数,使用$1、$2等

I believe you are using this sql activity for Redshift. Can you modify your sql script to refer to parameters using their positional notation. To refer to the parameters in the sql statement itself, use $1, $2, etc.

参见 http://www.postgresql.org/docs/9.1/static/sql-prepare.html

这篇关于Amazon Data Pipeline:如何在 SqlActivity 中使用脚本参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆