in design-patterns/scan_for_managers_gsi.py [0:0]
def scan_table(tableName,pageSize):
dynamodb = boto3.resource(**boto_args)
table = dynamodb.Table(tableName)
page = 1
count = 0
managers_count = 0
response = table.scan(
Limit=pageSize,
IndexName='GSI_2'
)
count = count + response['ScannedCount']
managers_count = managers_count + response['Count']
while 'LastEvaluatedKey' in response:
page += 1
response = table.scan(
Limit=pageSize,
IndexName='GSI_2',
ExclusiveStartKey=response['LastEvaluatedKey'])
count = count + response['ScannedCount']
managers_count = managers_count + response['Count']
return count, managers_count