Best method to Batch Update existing DynamoDb items using DynamoDb mapper

396 views Asked by At

I am trying to find the best way to batch update items in a DynamoDb table using Java’s Dynamo db mapper. Is DynamoDBSaveExpression the right way to do it? Can I use DynamoDBSaveExpression to batch update (batchSave()) items based on a condition or does it only work with save() ? I do not see any examples that using batchSave() with DynamoDBSaveExpression in the documentation.

For example, I have a list of employees with different roles (Engineering, Marketing, etc) under a column called role. I want to update another column assume their level based on their role value.

One way is to query a list and filter based on the role (or query it efficiently using GSI), update those records and then batchSave() them back to the database. But I am trying to find the best way to batch update them directly without having to query them using DynamoDb mapper.

I have looked at the existing questions online and have not been able to get a clear answer, and want to avoid using an out dated method. Thank you!

0

There are 0 answers