Skip to content

Conversation

@cipak
Copy link

@cipak cipak commented Nov 24, 2025

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

  • If the PR is a feature, add integration tests (*.integ.spec.ts).
  • If you wrote E2E tests, are they resilient to concurrent I/O?
  • If adding new public functions, did you add the @public tag 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.

@cipak cipak force-pushed the feat/paginate-batch-get-item branch from 7e3013a to 4644fb5 Compare November 24, 2025 16:38
@@ -0,0 +1,40 @@
import { BatchGetItemCommand, BatchGetItemCommandInput, DynamoDBClient } from "@aws-sdk/client-dynamodb";
Copy link
Contributor

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(...)

Copy link
Contributor

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"

Copy link
Author

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.

@cipak cipak force-pushed the feat/paginate-batch-get-item branch from dda9cc4 to 1af69d0 Compare November 26, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants