如何更新DynamoDB表?

时间:2015-11-05 09:59:47

标签: java amazon-web-services amazon-dynamodb aws-sdk

到目前为止我的代码:

        Map<String, String> expressionAttributeNames = new HashMap<String, String>();
        expressionAttributeNames.put("emailid", "abc@gmail.com");

        Map<String, Object> expressionAttributeValues = new HashMap<String, Object>();
        expressionAttributeValues.put(":age", 25);  // update Price to 25...
        expressionAttributeValues.put(":cgpa", 9);  //...but only if existing Price is 20  

        UpdateItemOutcome outcome = dynamoDB.updateItem(
            new PrimaryKey("emailid","nikhil@gmail.com"),
            "set age = :24", // UpdateExpression
            "emailid = :nikhil@gmail.com",     // ConditionExpression
            expressionAttributeNames,
            expressionAttributeValues);
         UpdateItemOutcome outcome =  dynamoDB.updateTable(updateTableRequest);

0 个答案:

没有答案