Open felixchin opened 3 years ago
@felixchin to confirm, this is mostly to obtain the COUNT number? Because you can specify the attributes to be retrieved from the database in the attributesToProject
field.
Any updates on this ?
"return only the count" functionality would be useful.
is this available ?
Any update on this issue?
Is there a workaround for this?
Have feature to implement?
Any workaround found ?
No updates here other than this is in our backlog.
As a reminder, please add a 👍 reaction in the original description of the issue to show interest, it helps us prioritizing all the feature requests we have.
Sad it has been years and this issue has not been resolved yet.
There are two "workarounds":
var count = 0
index.query(
QueryEnhancedRequest.builder()
.queryConditional(QueryConditional.keyEqualTo(key))
.attributesToProject("COUNT")
.build(),
).subscribe {
count += it.items()?.size ?: 0
}.await()
Sorry for the late update:
"count" was released in SDK version 2.20.153
(via https://github.com/aws/aws-sdk-java-v2/pull/4444).
Page
now exposes count, scanned count and consumed capacity - https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/enhanced/dynamodb/model/Page.html
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Reopening because while the SDK supports returning the count
field, it doesn't support specifying the select
parameter on the query request. This means that items still need to be retrieved from the service just to get the count.
The only workarounds available at this time are to use an execution interceptor that adds the setting to the request, or to use the low-level client to retrieve the count.
The most efficient option is probably to use select
via the low-level client to get the count
. To minimize the amount of data transferred when using the enhanced client for count
specifically, project none of the attributes of the item when scanning or querying.
The DynamoDB service team is tracking internally the feature request to add the rest of the select
functionality to the enhanced client.
There is no "Select" in QueryEnhancedRequest Builder.
Describe the Feature
Query the Dynamodb and return only the count.
Is your Feature Request related to a problem?
No
Proposed Solution
QueryEnhancedRequest.builder().select(Select select) The select should has those enums
Describe alternatives you've considered
Just use QueryRequest instead of QueryEnhancedRequest
Additional Context
Your Environment