簡體   English   中英

如何更新 Dynamo DB 中保留關鍵字的值。 錯誤:屬性名稱是保留關鍵字; 保留關鍵字:數據

[英]How to update a value for reserved keyword in Dynamo DB. Error: Attribute name is a reserved keyword; reserved keyword: data

這是我正在操作的更新查詢。 此處出現錯誤“set data =:updateValue”,data 是 Dynamo DB 的保留關鍵字。 我想我應該在這里使用更新 ExpressionAttributes 但不確定如何在這種情況下使用。

UpdateItemSpec updatetable = new UpdateItemSpec()
                .withPrimaryKey("pId", jsonContext.read("$.pId"))
                .withUpdateExpression("set data = :updateValue")
                .withValueMap(new ValueMap().with(":updateValue", jsonpathCreatorLocation2));
    locTable2.updateItem(updatetable);
final Map<String, String> expressions = new HashMap<>();
expressions.put("#d", "data");

UpdateItemSpec updatetable = new UpdateItemSpec()
                .withPrimaryKey("pId", jsonContext.read("$.pId"))
                .withUpdateExpression("set #d = :updateValue")
                .withValueMap(new ValueMap().with(":updateValue", jsonpathCreatorLocation2));
                .withExpressionAttributeNames(expressions);

locTable2.updateItem(updatetable);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM