Complete the code to start a parallel scan with 4 segments.
response = table.scan(Segment=[1], TotalSegments=4)
The Segment parameter starts from 0 up to TotalSegments - 1. So the first segment is 0.
Complete the code to specify the total number of segments for a parallel scan.
response = table.scan(Segment=2, TotalSegments=[1])
TotalSegments defines how many segments the table is divided into for parallel scanning. It must be at least 1.
Fix the error in the parallel scan code by completing the missing parameter.
response = table.scan(Segment=1, TotalSegments=3, [1]=True)
ConsistentRead=True ensures strongly consistent reads during the scan.
Fill both blanks to create a dictionary comprehension that maps segment numbers to their scan results.
results = {segment: table.scan(Segment=[1], TotalSegments=[2]) for segment in range(4)}The segment variable is used for the Segment parameter, and TotalSegments is 4 to match the range.
Fill all three blanks to filter scan results for items with attribute 'status' equal to 'active' in each segment.
filtered = {seg: [item for item in table.scan(Segment=[1], TotalSegments=[2])['Items'] if item.get('[3]') == 'active'] for seg in range(3)}Use 'seg' for Segment, 3 for TotalSegments, and 'status' as the attribute to filter by.