New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DynamoDBContext.FromScanAsync scans more than the provided limit before returning a result #3054
Comments
@JManou Good afternoon. Looking at the DynamoDB API Reference:
Are you noticing different behavior using other SDK(s) or AWS CLI? Thanks, |
@ashishdhingra when using the aws cli I can specify --max-items to get a limited number of elements without doing any filtering. Is it possible to achieve the same behavior using the SDK ? |
@JManou Thanks for your response. Kindly advise on the following:
Thanks, |
From what I understand from the doc limit is used for batching/pagination scan operation. Maybe a new attribute could be introduced in ScanOperationConfig to support --max-items as in the cli |
Describe the bug
I have the following code that should return the first 30 items, but it takes a few minutes to return the result.
Is there another way to specify the max items?
Expected Behavior
The result should be returned and the scan stopped once the limit is reached
Current Behavior
It looks like it scan all table and returns the last 30 items. Looking at the code of the DocumentSearch, as long as there is a LastEvaluatedKey the scan will continue. Shouldn't the GetRemainingAsync method take into account the configure limit ? It doesn't seem intuitive to use GetNextSetAsync
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.DynamoDBv2 3.7.201.12
Targeted .NET Platform
.NET 7
Operating System and version
Windows 11
The text was updated successfully, but these errors were encountered: