- Newest
- Most votes
- Most comments
The DynamoDB Web Console auto-paginates on your behalf, and sets a limit of 300, so it will always return 300 items if they exist:
{
"TableName":"YourTable",
"ReturnConsumedCapacity":"TOTAL",
"Limit":300,
"Select":"ALL_ATTRIBUTES",
"FilterExpression":"YourFilterExpression"
}
In order for you to achieve the same results, you will need to include pagination in your code. You can read more here
myItems = []
scanWithParams: async(params) => {
let res ={};
try {
res = await documentClient.scan(params).promise();
myItems = [...myItems, ...res['Items']];
if (data.LastEvaluatedKey) {
params.ExclusiveStartKey = res.LastEvaluatedKey;
return await getAllData(params);
}
}
catch (err) {
console.log('error scanning' , err);
}
return myItems;
}
Thank you.
Is it possible that the scan operation is returning more than 1MB of data? That is the limit per scan operation.
If by "run this directly" you mean in the console, what you're seeing is the console automatically calling scan multiple times to get additional data. This is indicated in the return data if the LastEvaluatedKey
parameter is present. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.Pagination.html
Hi .. thank you. This might be my problem. So what would be the way to get all of that data, from my lambda, if it exceeds 1MB?
Actually, it does paginate, but the first page I get in the console contains 300 items, not 36.
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
Directly in DynamoDB are you querying or scanning?
I'm scanning