【问题标题】:AWS redshift-data API: An error occurred (ResourceNotFoundException) when calling the DescribeStatement operation: Query does not existAWS redshift-data API:调用 DescribeStatement 操作时发生错误 (ResourceNotFoundException):查询不存在
【发布时间】:2021-04-20 09:02:54
【问题描述】:

几天来,我一直在努力解决最近发布的redshift data-api 中发生的一个奇怪问题。我正在尝试使用 execute statement api 在我的 Redshift 集群上执行 SQL 语句,并使用 list statements api 列出该语句。

在本地测试时,API 表现良好,列出语句没有问题。但是,在 Lambda 上部署我的代码后,我突然无法找到任何已执行的查询,即使我收到了 200 个执行语句请求的响应。

这是我的 CloudWatch 日志的摘录,显示了带有查询 ID 的执行语句 200 响应:

{
"level": "INFO",
"location": "execute_asynchronous_sql_query:71",
"message": {
    "message": "Successfully submitted sql query to redshift cluster",
    "query_id": "706a0ca1-084c-4733-a534-571993afd23a",
    "execution_statement_response": {
        "ClusterIdentifier": "#######",
        "CreatedAt": "2021-01-15 06:00:37.504000+00:00",
        "Database": "#######",
        "Id": "706a0ca1-084c-4733-a534-571993afd23a",
        "SecretArn": "arn:aws:secretsmanager:##############",
        "ResponseMetadata": {
            "RequestId": "#######",
            "HTTPStatusCode": 200,
            "HTTPHeaders": {
                "x-amzn-requestid": "#######",
                "content-type": "application/x-amz-json-1.1",
                "content-length": "237",
                "date": "Fri, 15 Jan 2021 06:00:38 GMT"
            },
            "RetryAttempts": 0
        },
        "StatementName": "ww-redshift-asynch-2021-01-15T06:00:37.206308-summary_spots.sql"
    }
},
"timestamp": "2021-01-15 06:00:38,008",
"service": "ww_dashboard",
"sampling_rate": 0,
"sample_rate": 0.4,
"xray_trace_id": "##############"

}

这是我在尝试使用具有该查询 ID 的 AWS cli 来 describe the SQL statement 状态时遇到的错误。

    aws redshift-data describe-statement --id 706a0ca1-084c-4733-a534-571993afd23a

    An error occurred (ResourceNotFoundException) when calling the DescribeStatement operation: Query does not exist.

【问题讨论】:

    标签: amazon-web-services amazon-redshift


    【解决方案1】:

    执行describe-statementget-statement-result 的角色/用户需要与您用于execute-statement 的角色/用户相同。

    另外,必须是同一地区。

    【讨论】:

    • 谢谢@fei,有相关文档吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-30
    • 2022-11-11
    • 1970-01-01
    • 1970-01-01
    • 2022-06-22
    • 1970-01-01
    相关资源
    最近更新 更多