简体   繁体   English

AppSync 与 DynamoDB“无效的 KeyConditionExpression:属性名称是保留关键字;保留关键字:名称”

[英]AppSync with DynamoDB "Invalid KeyConditionExpression: Attribute name is a reserved keyword; reserved keyword: name"

I'm working in the AWS console.我在 AWS 控制台中工作。 When I executed the following function on the query screen, "Invalid KeyConditionExpression: Attribute name is a reserved keyword; reserved keyword: name" has occurred.当我在查询界面执行如下function时,出现了“Invalid KeyConditionExpression: Attribute name is a reserved keyword; reserved keyword: name”。 I'm renaming it with "expressionAttributeNames", why?我用“expressionAttributeNames”重命名它,为什么?

{
    "operation" : "Query",
    "query" : {
        "expressionAttributeNames": {"#abc": "name"},
        "expression": "#abc = :abc",
        "expressionValues" : {
            ":abc" : $util.dynamodb.toDynamoDBJson($ctx.args.name)
        }
    }
}

You can use any attribute name in a key condition expression, provided that the first character is az or AZ and the second character (if present) is az, AZ, or 0-9.您可以在键条件表达式中使用任何属性名称,前提是第一个字符是 az 或 AZ,第二个字符(如果存在)是 az、AZ 或 0-9。 In addition, the attribute name must not be a DynamoDB reserved word.此外,属性名称不能是 DynamoDB 保留字。 The word "name" is already reserved by DynamoDB . “名称”一词已被 DynamoDB 保留 Check all reserved words here: https://docs.amazonaws.cn/en_us/amazondynamodb/latest/developerguide/ReservedWords.html在这里查看所有保留字: https://docs.amazonaws.cn/en_us/amazondynamodb/latest/developerguide/ReservedWords.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM