【发布时间】:2022-01-13 04:06:34
【问题描述】:
在我的步进函数中,我想执行一个 Athena 查询。我能够定义一个步骤并成功执行查询。但是,我想将一些参数作为输入传递并在查询字符串中使用它们。例如。
假设我的查询字符串是:
select * from <Data Source>.<database>.<tablename> where partition_0 = '2021';
我希望能够将年份作为输入 json 传递给 step 函数,例如:
{
"YYYY": 2021
}
是否可以在查询字符串中插入输入“YYYY”?如果有,怎么做?
示例步骤功能配置:
{
"Comment": "Start athena exececution",
"StartAt": "athena",
"States": {
"athena": {
"Type": "Task",
"InputPath": "$",
"Resource": "arn:aws:states:::athena:startQueryExecution.sync",
"Parameters": {
"QueryString": "select * from mycatalog.mydatabase.mytable where partition_0 = '2021'",
"WorkGroup": "primary",
"ResultConfiguration": {
"OutputLocation": "s3://mys3bucket"
}
},
"Next": "Pass"
},
"Pass": {
"Comment": "A Pass state passes its input to its output, without performing work. Pass states are useful when constructing and debugging state machines.",
"Type": "Pass",
"End": true
}
}
}
【问题讨论】:
标签: amazon-web-services aws-step-functions athena