1 個回答
- 最新
- 最多得票
- 最多評論
0
You can use the following code to achieve what you need:
import boto3
# get a list of items from dynamodb using pagination, default page size is 25 return all items
def get_items_from_dynamo_db(table_name, page_size=25, dynamodb=None):
if not dynamodb:
dynamodb = boto3.resource("dynamodb")
table = dynamodb.Table(table_name)
response = table.scan(Limit=page_size)
items = response["Items"]
while "LastEvaluatedKey" in response:
response = table.scan(ExclusiveStartKey=response["LastEvaluatedKey"], Limit=page_size)
items.extend(response["Items"])
return items
For your reference, this code was generated by CodeWhisperer using the following 2 lines:
import boto3
# get a list of items from dynamodb using pagination, default page size is 25 return all items
相關內容
- AWS 官方已更新 9 個月前
- AWS 官方已更新 2 年前
- AWS 官方已更新 2 年前