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
asked 8 months ago324 views
2 Answers
1
Accepted Answer

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
EXPERT
answered 8 months ago
0

Thank you Leeroy! Looking forward to it.

Arturo
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions