Skip to content

Instantly share code, notes, and snippets.

@mholmes-hs
Created May 28, 2020 17:07
Show Gist options
  • Save mholmes-hs/c3ac7d228dce15a119346b2aa9362fb6 to your computer and use it in GitHub Desktop.
Save mholmes-hs/c3ac7d228dce15a119346b2aa9362fb6 to your computer and use it in GitHub Desktop.
Multi Part Scan on DynamoDB
import boto3
from boto3.dynamodb.conditions import Key
def multi_part_scan():
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('Users')
response = table.scan()
result = response['Items']
while 'LastEvaluatedKey' in response:
response = table.scan(ExclusiveStartKey=response['LastEvaluatedKey'])
result.extend(response['Items'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment