Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dynamodb batch write updates existing items

Tags:

In this dynamodb documentation it is stated that existing items can not be updated with batch writing. However, when I try it replaces new items. How can I prevent it to update already exists one?

like image 624
mustafa.yavuz Avatar asked Feb 11 '14 13:02

mustafa.yavuz


People also ask

Can we do batch update in DynamoDB?

A bulk (batch) update refers to updating multiple rows belonging to a single table. However, DynamoDB does not provide the support for this.

Does batch write overwrite?

Chen's answer is correct; BatchWriteItem always overwrites.

How do I update a DynamoDB item?

To update an existing item in an Amazon DynamoDB table, you use the UpdateItem operation. You must provide the key of the item that you want to update. You must also provide an update expression, indicating the attributes that you want to modify and the values that you want to assign to them.

What is the use of add new attribute method in DynamoDB?

ADD - Causes DynamoDB to create an item with the supplied primary key and number (or set of numbers) for the attribute value. The only data types allowed are Number and Number Set.


1 Answers

As stated in the documentation if you re-put an item it replaces the old one.

Update item adds/changed attributes but doesn't remove other ones.

So basically what you are doing is replacing items and not updating them.

With batch write you can't put conditions on individual items thus you can't prevent it from updating.

like image 173
Chen Harel Avatar answered Sep 18 '22 15:09

Chen Harel