Python 3.x Python DynamoDB从特定的表条目创建自定义的上次\u计算的\u键
我们需要创建自定义的上次求值键 用例如下所示: 第一个扫描表有十条记录,当我进行第二次扫描操作时,第十条记录应该是我最后一次计算的键 提前谢谢Python 3.x Python DynamoDB从特定的表条目创建自定义的上次\u计算的\u键,python-3.x,amazon-dynamodb,flash-message,botocore,Python 3.x,Amazon Dynamodb,Flash Message,Botocore,我们需要创建自定义的上次求值键 用例如下所示: 第一个扫描表有十条记录,当我进行第二次扫描操作时,第十条记录应该是我最后一次计算的键 提前谢谢 #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
#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)
编辑:
exclusive_start_key(列表或元组)–要从中继续早期查询的项的主键。这将作为该查询中的LastEvaluatedKey提供
比如说
exclusive_start_key = ('myhashkey');
或
感谢您的回复,没有“max_results”是不起作用的??对不起,应该是限制。任何其他生成独占开始键的方法都只需使用要从中开始的项的主键创建一个元组。
exclusive_start_key = ('myhashkey', 'myrangekey');