Include DynamoDB LastEvaluatedKey response value in Layer2 scan #1036

mminer opened this Issue Oct 5, 2012 · 6 comments


None yet
4 participants

mminer commented Oct 5, 2012

Currently there is no way to get the value of the last evaluated key after calling Layer2.scan (and, consequently, Table.scan). The ConsumedCapacityUnits response value is included as a property in the TableGenerator class after performing a Layer2 scan operation; it would be useful if LastEvaluatedKey was similarly available.

yadutaf commented Oct 5, 2012

I guess this is because Scan is wrapped in a generator to abstract the chunking. Can you be more specific about you use-case ?

mminer commented Oct 5, 2012

I supply a max_results parameter to the scan function, intending to page through the results 100 at a time. But without knowing the last evaluated key, I'm unsure of the value to supply for exclusive_start_key when fetching the next page of results.

Now, to get ConsumedCapacityUnits I can simply use my_scan.consumed_units. Ideally I could also use my_scan.last_evaluated_key. My current workaround is to use Layer1's scan function instead.

aflag commented Nov 1, 2012

I think another workaround you may consider is to use the key of the last returned item. It may cause some rework, but other than that it should be fine.

mminer commented Nov 2, 2012

The workaround you suggest is reasonable, though DynamoDB returns a null value for LastEvaluatedKey when the scan is complete, signalling that subsequent scans are unnecessary. Simply finding the key of the last returned item ignores this helpful piece of information.


pasc commented Feb 27, 2013

This looks like it was fixed in #1125 which has been merged?

mminer commented Feb 27, 2013

This has indeed been added; calling my_scan.last_evaluated_key does the trick. Nice.

mminer closed this Feb 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment