ReturnConsumedCapacity Support for DynamoDB Transactions in DynamoDBContext and Table APIs#4412
Draft
aanton-git wants to merge 9 commits into
Conversation
irina-herciu
suggested changes
May 26, 2026
| /// </summary> | ||
| /// <param name="hashKey">Hash key of the item to get.</param> | ||
| void AddKey(object hashKey); | ||
| /// <param name="returnConsumedCapacity">Constants used for properties of type ReturnConsumedCapacity</param> |
Contributor
There was a problem hiding this comment.
update summary with actual scope, but move it to TransactGetConfig
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public void AddKeys(IEnumerable<T> keyObjects) |
Contributor
There was a problem hiding this comment.
this should not default to null ReturnConsumedCapacity
| { | ||
| var transactItems = Items.Select(item => item.GetRequest()).ToList(); | ||
| var request = new TransactWriteItemsRequest { TransactItems = transactItems }; | ||
| var returnConsumedCapacity = |
Contributor
There was a problem hiding this comment.
the ReturnConsumedCapacity should be part of the TransactWriteConfig and set only one time when CreateTransactWrite, not added for each item
| /// <param name="item">Item to save.</param> | ||
| void AddSaveItem(T item); | ||
| /// <param name="returnConsumedCapacity">Constants used for properties of type ReturnConsumedCapacity.</param> | ||
| void AddSaveItem(T item, ReturnConsumedCapacity returnConsumedCapacity = null); |
Contributor
There was a problem hiding this comment.
move ReturnConsumedCapacity to config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add ReturnConsumedCapacity support for DynamoDB transactional operations exposed through DynamoDBContext and Table-level APIs in the AWS SDK for .NET.
Currently, when executing transactions via high-level .NET abstractions (such as DynamoDBContext transactional APIs or Table-based helpers), there is no way to request or retrieve consumed capacity information. This capability is supported by DynamoDB itself and exposed in other SDKs, but is missing from the .NET high-level APIs.
Motivation and Context
I need this feature to understand and control the capacity cost of transactional workloads when using DynamoDB through DynamoDBContext.
Without ReturnConsumedCapacity:
Expose ReturnConsumedCapacity at the DynamoDBContext and Table abstraction level for transactional operations, in a way consistent with existing .NET SDK patterns.
Specifically:
Allow configuring ReturnConsumedCapacity when executing transactional reads and writes through DynamoDBContext
Surface consumed-capacity data in the transaction response
Include total and per-table capacity information, consistent with other DynamoDB APIs
This should not require customers to drop down to low-level TransactWriteItemsRequest / TransactGetItemsRequest APIs.
The AWS SDK for Java v2 Enhanced Client already supports this feature, providing a clear reference for API shape and behavior.
https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/enhanced/dynamodb/model/TransactWriteItemsEnhancedRequest.Builder.html
Testing
Screenshots (if appropriate)
Types of changes
Checklist
License