i am trying to check if key exist on table before making putItem operation on dynamodb to prevent overriding existing key value
Asked
Active
Viewed 308 times
-1
-
Why you have asked this question, if you already know the answer? – Gaurav Jeswani Jan 11 '22 at 18:06
1 Answers
1
PutItemExpressionSpec PUT_ITEM_EXPRESSION_SPEC = new ExpressionSpecBuilder()
.withCondition(ExpressionSpecBuilder.S("uuid").notExists())
.buildForPut();
// create item
PutItemSpec putItemSpec = new PutItemSpec()
.withItem(item)
.withExpressionSpec(PUT_ITEM_EXPRESSION_SPEC); // Checking if UUID exists on the Table
// get Table
table.putItem(putItemSpec);

Vijay Babu
- 33
- 8