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

查看:78
本文介绍了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天全站免登陆