amazon web services - how to get all results in a query to a aws dynamodb table? -


the first example given in http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/queryingjavadocumentapi.html returns itemcollection

according http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/queryandscan.html#pagination need lastevaluatedkey , perform query again there isn't getlastevaluatedkey itemcollection returned dynamodb.gettable("tablename").query(keyattribute)

itemcollection documentation states n/w calls made if iterated across page boundary have make calls till again given in http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/queryandscan.html#pagination or not

getlastevaluatedkey method of queryresult (or scanresult).

in example refer to, collection of queryoutcome used, bypassing queryresult. last evaluated key, try doing

 queryrequest request = new queryrequest();  request.settablename(tablename);  queryresult result = dynamodb.query(request);  itemcollection<queryoutcome> items = result.getitems();  map<string,attributevalue> lastkey = result.getlastevaluatedkey(); 

i hope helps.


Comments