DynamoDBLocal support for ReturnValuesOnConditionCheckFailure for single write operations?

3

Currently this feature is not supported in DynamodbLocal 2.0, and the item returned is null for single write operations (but works for transactions). Is there any plans to add support?

example:

try {
    com.amazonaws.services.dynamodbv2.model.PutItemRequest request2 = new com.amazonaws.services.dynamodbv2.model.PutItemRequest()
            .withTableName(tableName)
            .withItem(Map.of(keyName, new com.amazonaws.services.dynamodbv2.model.AttributeValue(keyValue))) // matches existing document
            .withConditionExpression("attribute_exists(#key)")
            .withExpressionAttributeNames(Map.of("#key", "non_existing_attribute"))
            .withReturnValuesOnConditionCheckFailure("ALL_OLD");
    dynamoDB.putItem(request2);
} catch (final ConditionalCheckFailedException e) {
    System.out.println("Return value: " + e.getItem()); // returns null
}
Arturo
已提问 8 个月前333 查看次数
2 回答
1
已接受的回答

Thanks for submitting this.

It works currently for transactions as that API parameter has existed for some time.

As for singleton operations, I will bring this up with our team internally. Unfortunately I cannot provide an ETA for this feature to be implemented, but it will be implemented in future releases.

profile pictureAWS
专家
已回答 8 个月前
0

Thank you Leeroy! Looking forward to it.

Arturo
已回答 8 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则