scanTable(List attributesToGet) {
List<> allRows = new LinkedList<>();
ScanResult result = null;
do{
ScanRequest scanRequest = new ScanRequest().withTableName(this.tableName).withAttributesToGet(attributesToGet);
if(result != null){
scanRequest.setExclusiveStartKey(result.getLastEvaluatedKey());
}
long time = System.currentTimeMillis();
result = this.client.scan(scanRequest);
allRows.addAll(result.getItems());
log.info("scan in: " + (System.currentTimeMillis() - time) + " ms");
} while(result.getLastEvaluatedKey() != null);
return allRows;
}
Tuesday, September 30, 2014
How to fetch all results from DynamoDB
Posted by
Dinesh Wijekoon
at
12:55 PM
Dynamo DB simple scan will not give you all the results.
Subscribe to:
Comments (Atom)