Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Include DynamoDB LastEvaluatedKey response value in Layer2 scan #1036

Closed
mminer opened this Issue · 6 comments

4 participants

@mminer

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

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

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

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

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

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

@mminer

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

@mminer mminer closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.