in design-patterns/scan_logfile_simple.py [0:0]
def scan_table(tableName):
dynamodb = boto3.resource(**boto_args)
table = dynamodb.Table(tableName)
totalbytessent = 0
pageSize = 10000
fe = "responsecode <> :f"
eav = {":f": 200}
response = table.scan(
FilterExpression=fe,
ExpressionAttributeValues=eav,
Limit=pageSize,
ProjectionExpression='bytessent')
for i in response['Items']:
totalbytessent += i['bytessent']
while 'LastEvaluatedKey' in response:
response = table.scan(
FilterExpression=fe,
ExpressionAttributeValues=eav,
Limit=pageSize,
ExclusiveStartKey=response['LastEvaluatedKey'],
ProjectionExpression='bytessent')
for i in response['Items']:
totalbytessent += i['bytessent']
return totalbytessent