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
feita há 8 meses333 visualizações
2 Respostas
1
Resposta aceita

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
ESPECIALISTA
respondido há 8 meses
0

Thank you Leeroy! Looking forward to it.

Arturo
respondido há 8 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas