I am trying to find a better way to remove an attribute from an element in Dynamo DB. Below I tried, but I get an exception saying DELETE is not supported for either type N or S.
Exception in the thread "main" Status code: 400, AWS Service: AmazonDynamoDB, AWS Request ID: 09MRO4PVTJ8IK6OHLKSM551REJVV4KQNSO5AEMVJF66Q9ASUAAJG, AWS Error code: ValidationException, one or more of the following parameters were not received for the AWS error message: at .amazonaws.http.AmazonHttpClient.handleErrorResponse (AmazonHttpClient.java=44) at com.amazonaws.http.AmazonHttpClient.executeHelper (AmazonHttpClient.java:284) at com.amazonaws.http.AmazonHttp > com.amazonaws.services.dynamodb.AmazonDynamoDBClient.invoke (AmazonDynamoDBClient.java:675) at> com.amazonaws.services.dynamodb.AmazonDynamoDBClient.updateItem (AmazonDynamoDBClient.java opin71)
Key pk = new Key(new AttributeValue().withN(Long.toString(123))); AttributeValueUpdate avu = new AttributeValueUpdate(new AttributeValue().withN("555"), "DELETE"); Map<String, AttributeValueUpdate> m = new HashMap<String, AttributeValueUpdate>(); m.put(String.valueOf(555), avu); UpdateItemRequest uir = new UpdateItemRequest("users", pk, m); dynamoDB.updateItem(uir);
One point of confusion is why the attribute value matters for deletion. I really want to remove the attribute name and any associated values, but could not find a suitable way to do this in the SDK.
Help will be appreciated.
source share