You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用AWS DynamoDB batch-execute-statement报Expected identifier错误求助

DynamoDB batch-execute-statement 语法错误排查

问题场景

尝试通过batch-execute-statement首次更新DynamoDB表条目,语句文件内容如下:

[
  {
    "Statement": "UPDATE 'table_t268468eaf8b64c7b9d3eb2655e98ebd5' SET x=1678976403 WHERE Key='e1c09d48-fdc5-41eb-8ca2-f7b4ff8a01c5' and anotherColumn='e1c09d48-fdc5-41eb-8ca2-f7b4ff8a01c5'"
  }
]

执行命令:

aws dynamodb batch-execute-statement --statements file://batch-execute.json

返回错误:

{
    "Responses": [
        {
            "Error": {
                "Code": "ValidationError",
                "Message": "Statement wasn't well formed, can't be processed: Expected identifier for simple path"
            }
        }
    ]
}

错误原因

DynamoDB使用的PartiQL语法中,表名和属性名不能用单引号包裹,单引号仅用于包裹字符串类型的属性值。你的语句里错误地给表名加了单引号,导致语法解析失败。

修正后的语句文件

将表名的单引号移除,属性名保持无引号状态即可:

[
  {
    "Statement": "UPDATE table_t268468eaf8b64c7b9d3eb2655e98ebd5 SET x=1678976403 WHERE Key='e1c09d48-fdc5-41eb-8ca2-f7b4ff8a01c5' AND anotherColumn='e1c09d48-fdc5-41eb-8ca2-f7b4ff8a01c5'"
  }
]

注:AND关键字建议大写(PartiQL对大小写不敏感,但大写更符合通用语法规范)。

重新执行原命令即可完成更新操作。

内容的提问来源于stack exchange,提问作者kostas.kapasakis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 06:35:23