23
votes

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?

1
It is overwriting your entries, that's all. If you give overwrite=False then it won't overwritetheBuzzyCoder
@theBuzzyCoder There's no place in the BatchWriteItem API to provide an overwrite parameter. Chen's answer is correct; BatchWriteItem always overwrites.Dan Hook

1 Answers

25
votes

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.