• <tfoot id='xQEDQ'></tfoot>

      <small id='xQEDQ'></small><noframes id='xQEDQ'>

      1. <legend id='xQEDQ'><style id='xQEDQ'><dir id='xQEDQ'><q id='xQEDQ'></q></dir></style></legend>
          <bdo id='xQEDQ'></bdo><ul id='xQEDQ'></ul>

        <i id='xQEDQ'><tr id='xQEDQ'><dt id='xQEDQ'><q id='xQEDQ'><span id='xQEDQ'><b id='xQEDQ'><form id='xQEDQ'><ins id='xQEDQ'></ins><ul id='xQEDQ'></ul><sub id='xQEDQ'></sub></form><legend id='xQEDQ'></legend><bdo id='xQEDQ'><pre id='xQEDQ'><center id='xQEDQ'></center></pre></bdo></b><th id='xQEDQ'></th></span></q></dt></tr></i><div id='xQEDQ'><tfoot id='xQEDQ'></tfoot><dl id='xQEDQ'><fieldset id='xQEDQ'></fieldset></dl></div>
      2. 是否可以更改 DynamoDB 表中 Range 键的值?

        Is It possible to change value of Range key in DynamoDB Table?(是否可以更改 DynamoDB 表中 Range 键的值?)
      3. <tfoot id='zBxhg'></tfoot>
        <i id='zBxhg'><tr id='zBxhg'><dt id='zBxhg'><q id='zBxhg'><span id='zBxhg'><b id='zBxhg'><form id='zBxhg'><ins id='zBxhg'></ins><ul id='zBxhg'></ul><sub id='zBxhg'></sub></form><legend id='zBxhg'></legend><bdo id='zBxhg'><pre id='zBxhg'><center id='zBxhg'></center></pre></bdo></b><th id='zBxhg'></th></span></q></dt></tr></i><div id='zBxhg'><tfoot id='zBxhg'></tfoot><dl id='zBxhg'><fieldset id='zBxhg'></fieldset></dl></div>
              <tbody id='zBxhg'></tbody>
            <legend id='zBxhg'><style id='zBxhg'><dir id='zBxhg'><q id='zBxhg'></q></dir></style></legend>
              <bdo id='zBxhg'></bdo><ul id='zBxhg'></ul>

                  <small id='zBxhg'></small><noframes id='zBxhg'>

                • 本文介绍了是否可以更改 DynamoDB 表中 Range 键的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道这可能是一个非常愚蠢的问题,但我是 DynamoDB 的新手.

                  I know it may be a very silly question, but I am new to DynamoDB.

                  我怀疑是否可以在 DynamoDB 中更新 Range Key 的值.

                  My doubt is is it possible to update the value of a Range Key in DynamoDB.

                  假设我的表是TEST"

                  Suppose My Table is "TEST"

                  {
                  ID : PK/HK
                  Date : RK
                  Name : GSI 
                  Add : LSI
                  }
                  

                  我要修改Date属性.

                  表中的初始值为:

                  {
                  ID = "344"
                  Date = "5656"
                  Name = "ABC"
                  }
                  

                  在下面运行此代码.我可以更改 GSI 的 Name 属性.

                  Running this code below. I am able to change the Name Attribute which is GSI.

                  Map<String,AttributeValue> item = new HashMap<String,AttributeValue>();
                  item.put("ID", new AttributeValue("344"));
                  item.put("Date", new AttributeValue("5656"));
                  
                  Map<String,AttributeValueUpdate> item1 = new HashMap<String,AttributeValueUpdate>();
                  
                  AttributeValueUpdate update = new AttributeValueUpdate().withValue(new AttributeValue("AMIT")).withAction("PUT");
                  item1.put("Name", update);
                  
                  
                  UpdateItemRequest updateItemreq = new UpdateItemRequest("Test",item,item1);
                  UpdateItemResult updateItemres = dynamoDBUSEast.updateItem(updateItemreq);
                  

                  但是当我改变这一行时

                  item1.put("Name", update);
                  

                   item1.put("Date", update);
                  

                  我遇到了一些错误

                  Exception in thread "main" com.amazonaws.AmazonServiceException: One or more parameter values were invalid: Cannot update attribute Date. This attribute is part of the key (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: HRRP24Q7C48AMD8ASAI992L6MBVV4KQNSO5AEMVJF66Q9ASUAAJG)
                      at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:820)
                      at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:439)
                      at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:245)
                      at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:2908)
                      at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.updateItem(AmazonDynamoDBClient.java:1256)
                  

                  那么是否可以更改范围键值?

                  So Is it possible to change the range Key value?

                  推荐答案

                  不,就像异常消息状态一样,您 无法更新属性 Date.该属性是键的一部分.

                  No, like the exception message states, you Cannot update attribute Date. This attribute is part of the key.

                  您还可以在 AttributeUpdates 文档:

                  You can also see this under the AttributeUpdates documentation:

                  要修改的属性的名称,要对每个属性执行的操作,以及每个的新值.如果您要更新的属性是该表上任何索引的索引键属性,该属性type 必须与 AttributesDefinition 中定义的索引键类型匹配的表说明.您可以使用 UpdateItem 更新任何非键属性.

                  The names of attributes to be modified, the action to perform on each, and the new value for each. If you are updating an attribute that is an index key attribute for any indexes on that table, the attribute type must match the index key type defined in the AttributesDefinition of the table description. You can use UpdateItem to update any nonkey attributes.

                  文档声明您可以更新作为该表上任何索引的索引键属性的属性"的任何属性,这意味着当您更新投影到索引上的属性时,即使它是一部分在该索引键中,该索引也将被更新以反映原始项目.

                  The documentation states that you can update any attribute for "an attribute that is an index key attribute for any indexes on that table", which means that when you update an attribute that is projected onto an index, even it is is part of that indexes key, that index will also be updated to reflect the original item.

                  这篇关于是否可以更改 DynamoDB 表中 Range 键的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                  <tfoot id='eQAyk'></tfoot>
                    • <bdo id='eQAyk'></bdo><ul id='eQAyk'></ul>
                      • <legend id='eQAyk'><style id='eQAyk'><dir id='eQAyk'><q id='eQAyk'></q></dir></style></legend>
                        <i id='eQAyk'><tr id='eQAyk'><dt id='eQAyk'><q id='eQAyk'><span id='eQAyk'><b id='eQAyk'><form id='eQAyk'><ins id='eQAyk'></ins><ul id='eQAyk'></ul><sub id='eQAyk'></sub></form><legend id='eQAyk'></legend><bdo id='eQAyk'><pre id='eQAyk'><center id='eQAyk'></center></pre></bdo></b><th id='eQAyk'></th></span></q></dt></tr></i><div id='eQAyk'><tfoot id='eQAyk'></tfoot><dl id='eQAyk'><fieldset id='eQAyk'></fieldset></dl></div>

                            <tbody id='eQAyk'></tbody>

                            <small id='eQAyk'></small><noframes id='eQAyk'>