question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DynamoDB Enhanced Client: batch writes

See original GitHub issue

Describe the feature

Requested feature: batchPutItem(Collection<T>) and batchUpdateItem(Collection<T>) methods on DynamoDbTable.

Use Case

The low-level client supports batch transactional writes, and the Enhanced client works by mapping POJOs onto low-level operations. I would like to write a series of records transactionally from POJOs, but the Enhanced client only supports single-record operations. Instead, I want to prepare the records to be saved and save them as a batch.

Proposed Solution

PutItemOperation (with the other TableOperations) generates a PutItemRequest, and the low-level client already supports the batchWriteItem operation that takes multiple PutItemRequests and batches them. All of the existing logic for the Enhanced client could remain in place with a scatter-gather implementation that collects the generated requests and executes them via batchWriteItem.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

2.17.260

JDK version used

OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

Operating System and version

Gentoo Linux

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
debora-itocommented, Oct 11, 2022

Quick update: this was added to the backlog.

Anyone who’d like to see this supported in the Java SDK make sure to add a 👍 to the original description to help us with prioritization.

0reactions
nickcaballerocommented, Sep 8, 2022

Regarding the batchPut, it can be written as a TableOperation that takes a BatchWriteItemEnhancedRequest<T> and returns a BatchWriteResult<T>, where the request/result are more strictly typed versions of the already available types. That would also pave the road for supporting a batchDelete.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DynamoDbEnhancedClient (AWS SDK for Java - 2.18.38)
The additional configuration parameters that the enhanced client supports are defined in the BatchWriteItemEnhancedRequest . A single call to BatchWriteItem has ...
Read more >
Perform batch write in DynamoDB in Java - Stack Overflow
See this example that demonstrates how to insert many items into an Amazon DynamoDB table by using the enhanced client.
Read more >
Batch operations using AWS SDK for Java document API
This section provides examples of batch write and batch get operations in Amazon DynamoDB using the AWS SDK for Java Document API. Note....
Read more >
BatchWriteItemEnhancedRequest.Builder (AWS Java SDK
Sets one or more write batches to use in the batchWriteItem operation. Parameters: writeBatches - one or more WriteBatch , separated by comma....
Read more >
aws-doc-sdk-examples/EnhancedBatchWriteItems.java at main
//snippet-sourcedescription:[EnhancedBatchWriteItems.java demonstrates how to insert many items into an Amazon DynamoDB table by using the enhanced client.].
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found