- Le plus récent
- Le plus de votes
- La plupart des commentaires
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.
Contenus pertinents
- demandé il y a 8 mois
- demandé il y a un an
- demandé il y a un an
- AWS OFFICIELA mis à jour il y a 10 mois
- AWS OFFICIELA mis à jour il y a 2 ans
- AWS OFFICIELA mis à jour il y a un an
Directly in DynamoDB are you querying or scanning?
I'm scanning