-
Notifications
You must be signed in to change notification settings - Fork 647
feat(dynamodb): add batch get item paginators for low level and document client #7522
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
base: main
Are you sure you want to change the base?
Conversation
7e3013a to
4644fb5
Compare
| @@ -0,0 +1,40 @@ | |||
| import { BatchGetItemCommand, BatchGetItemCommandInput, DynamoDBClient } from "@aws-sdk/client-dynamodb"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this paginator should be placed with the client rather than util-dynamodb, but named in a way that prevents collisions between it and the generated paginators
perhaps export async function* customPaginateBatchGetItem(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as for the naming, we cannot use the same pattern as the generated paginator because it would break backwards compatibility if the type signature changes between the hand-written and generated paginator.
it can be named something subtly different rather than "customPaginateBatchGetItem", perhaps "paginatedBatchGetItem"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed the functions as suggested (paginatedBatchGetItem for the low-level client and paginatedBatchGet for document client).
regarding moving the low-level client paginator from util-dynamodb to client-dynamodb, I'll leave that part to the next developer, as today I am transitioning off the project.
dda9cc4 to
1af69d0
Compare
…r generated versions
Description
This pull request adds paginators for the DynamoDB BatchGetItemCommand (low level client) and BatchGetCommand (document client). Similar to the implementation in other AWS SDKs (Java, .Net, Go), these paginators work by repeatedly issuing batch get commands until the returned UnprocessedKeys object is missing (or empty), or a service error is returned.
Unlike the other paginators (paginateQuery and paginateScan), these batch get paginators do not mutate the received input.
Testing
This change was tested using a DynamoDB table with 100 items, each 400kb in size. The first test was with a provisioned capacity of 5 RCUs, and the second with 10,000 RCUs . In both tests, the paginators returned the 100 items in 7 pages of maximum 17 items each.
Checklist
*.integ.spec.ts).@publictag and enable doc generation on the package?By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.