2

we need create custom last evaluated key

The use case goes Here:

First scan table its having ten records,the tenth record should my last evaluated key when i do second time scan operation

Thanks in advance

VC.One
  • 14,790
  • 4
  • 25
  • 57
Robert
  • 3,373
  • 1
  • 18
  • 34

1 Answers1

2
#Exclusive start key should be null for your first page
esk = None
#Get the first page
scan_generator = MyTable.scan(Limit=10, exclusive_start_key=esk)
#Get the key for the next page
esk = scan_generator.kwargs['exclusive_start_key'].values()
#Now get page 2
scan_generator = MyTable.scan(Limit=10, exclusive_start_key=esk)

EDIT:

exclusive_start_key (list or tuple) – Primary key of the item from which to continue an earlier query. This would be provided as the LastEvaluatedKey in that query.

For example

exclusive_start_key = ('myhashkey');

or

exclusive_start_key = ('myhashkey', 'myrangekey');
F_SO_K
  • 13,640
  • 5
  • 54
  • 83