我一直在試圖抓取我的GSI
之一上的所有記錄,並且看到只有在執行掃描時,纔有迴應在響應中使用LastEvaluatedKey
的選項。我沒有找到更好的方式使用pagination
使用boto3
中的查詢。是否可以使用查詢進行分頁。在10Gb大小的桌子上Boto3 dynamodb查詢
從boto3.dynamodb.conditions進口boto3 導入密鑰,的Attr
dynamodb = boto3.resource('dynamodb')
res = table.query(
TableName='myTable',
IndexName='my-index',
KeyConditionExpression=Key('myVal').eq(1)
)
while 'LastEvaluatedKey' in res:
for item in res['Items']:
print item #returns only a subset of them
請提供您想要實現的更多細節。 – mootmoot
我想查詢一個索引來獲取dynamodb表中的所有記錄。上面的代碼片段只返回了幾百條記錄,而有數百萬條記錄。無法使用查詢功能進行分頁。我能夠使用掃描進行分頁。 – ZZzzZZzz