Skip to main content

aws-dynamodb-parallel-scan

Amazon DynamoDB parallel scan paginator for boto3.

Installation

Install from PyPI with pip

pip install aws-dynamodb-parallel-scan

or with the package manager of choice.

Usage

The library is a drop-in replacement for boto3 DynamoDB Scan Paginator. Example:

import aws_dynamodb_parallel_scan
import boto3

# Create DynamoDB client to use for scan operations
client = boto3.resource("dynamodb").meta.client

# Create the parallel scan paginator with the client
paginator = aws_dynamodb_parallel_scan.get_paginator(client)

# Scan "mytable" in five segments. Each segment is scanned in parallel.
for page in paginator.paginate(TableName="mytable", TotalSegments=5):
    items = page.get("Items", [])

Notes:

  • paginate() accepts the same arguments as boto3 DynamoDB.Client.scan() method. Arguments are passed to DynamoDB.Client.scan() as-is.

  • paginate() uses the value of TotalSegments argument as parallelism level. Each segment is scanned in parallel in a separate thread.

  • paginate() yields DynamoDB Scan API responses in the same format as boto3 DynamoDB.Client.scan() method.

See boto3 DynamoDB.Client.scan() documentation for details on supported arguments and the response format.

CLI

This package also provides a CLI tool (aws-dynamodb-parallel-scan) to scan a DynamoDB table with parallel scan. The tool supports all non-deprecated arguments of DynamoDB Scan API. Execute aws-dynamodb-parallel-scan -h for details

Here's some examples:

# Scan "mytable" sequentially
$ aws-dynamodb-parallel-scan --table-name mytable
{"Items": [...], "Count": 10256, "ScannedCount": 10256, "ResponseMetadata": {}}
{"Items": [...], "Count": 12, "ScannedCount": 12, "ResponseMetadata": {}}

# Scan "mytable" in parallel (5 parallel segments)
$ aws-dynamodb-parallel-scan --table-name mytable --total-segments 5
{"Items": [...], "Count":32, "ScannedCount":32, "ResponseMetadata": {}}
{"Items": [...], "Count":47, "ScannedCount":47, "ResponseMetadata": {}}
{"Items": [...], "Count":52, "ScannedCount":52, "ResponseMetadata": {}}
{"Items": [...], "Count":34, "ScannedCount":34, "ResponseMetadata": {}}
{"Items": [...], "Count":40, "ScannedCount":40, "ResponseMetadata": {}}

# Scan "mytable" in parallel and return items, not Scan API responses (--output-items flag)
$ aws-dynamodb-parallel-scan --table-name mytable --total-segments 5 \
    --output-items
{"pk": {"S": "item1"}, "quantity": {"N": "99"}}
{"pk": {"S": "item24"}, "quantity": {"N": "25"}}
...

# Scan "mytable" in parallel, return items with native types, not DynamoDB types (--use-document-client flag)
$ aws-dynamodb-parallel-scan --table-name mytable --total-segments 5 \
    --output-items --use-document-client
{"pk": "item1", "quantity": 99}
{"pk": "item24", "quantity": 25}
...

# Scan "mytable" with a filter expression, return items
$ aws-dynamodb-parallel-scan --table-name mytable --total-segments 5 \
    --filter-expression "quantity < :value" \
    --expression-attribute-values '{":value": {"N": "5"}}' \
    --output-items
{"pk": {"S": "item142"}, "quantity": {"N": "4"}}
{"pk": {"S": "item874"}, "quantity": {"N": "1"}}

# Scan "mytable" with a filter expression using native types, return items
$ aws-dynamodb-parallel-scan --table-name mytable --total-segments 5 \
    --filter-expression "quantity < :value" \
    --expression-attribute-values '{":value": 5}' \
    --use-document-client --output-items
{"pk": "item142", "quantity": 4}
{"pk": "item874", "quantity": 1}

Development

Requires Python 3 and uv. Useful commands:

# Run tests (integration test requires rights to create, delete and use DynamoDB tables)
make test

# Run linters
make -k lint

# Format code
make format

License

MIT

Credits

Metadata

Release files for aws-dynamodb-parallel-scan 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-dynamodb-parallel-scan 1.2.0
File Size Uploaded Provenance Actions
aws_dynamodb_parallel_scan-1.2.0.tar.gz 3.9 kB Without provenance Details for aws_dynamodb_parallel_scan-1.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aws-dynamodb-parallel-scan 1.2.0
File Interpreter ABI Platform Actions
aws_dynamodb_parallel_scan-1.2.0-py3-none-any.whl Python 3 none any Details for aws_dynamodb_parallel_scan-1.2.0-py3-none-any.whl

Total release size: 9.4 kB

Release files / aws_dynamodb_parallel_scan-1.2.0.tar.gz

Download URL aws_dynamodb_parallel_scan-1.2.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a52a4b86e4694131663cc3230e45330d54600d7c7ebf203155c13a80bfcae76c
BLAKE2b-256 checksum
How to use checksums
b96f301631ce14549a83e099247dee08e95b3cc50ffb3feff5a87b89cd1fd3f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / aws_dynamodb_parallel_scan-1.2.0-py3-none-any.whl

Download URL aws_dynamodb_parallel_scan-1.2.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27cb1a0871d6574399a6feb6db0254fbcbedac624d7eb90b4709a9a5ff4c8284
BLAKE2b-256 checksum
How to use checksums
5903ad49d7c8818fbe4395267aa0f494c36a944d479d781e7dccab1e04ffcdda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for aws-dynamodb-parallel-scan 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page