Reputation: 915
I am using put_item
along with ConditionExpression='attribute_not_exists(#primary_key)'
to avoid duplicates for some dataset inserts.
Is it possible to allow put_item
to return the duplicate item without having to perform any other client API call?
Upvotes: 0
Views: 152
Reputation: 5747
According to the put_item docs
Use ReturnValues if you want to get the item attributes as they appeared before they were updated with the PutItem request. For PutItem, the valid values are:
NONE - If ReturnValues is not specified, or if its value is NONE, then nothing is returned. (This setting is the default for ReturnValues.)
ALL_OLD - If PutItem overwrote an attribute name-value pair, then the content of the old item is returned.
I'm not sure how this behavior works when using attribute_not_exists
, but perhaps it can give you a starting point?
Upvotes: 1