0
0
DynamoDBquery~10 mins

Unprocessed items handling in DynamoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check if there are unprocessed items after a batch write.

DynamoDB
if response.get('[1]'):
    print('There are unprocessed items.')
Drag options to blanks, or click blank then click option'
AUnprocessedItems
BItems
CProcessedItems
DBatchItems
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ProcessedItems' instead of 'UnprocessedItems'.
Checking a wrong key like 'Items' or 'BatchItems'.
2fill in blank
medium

Complete the code to retry unprocessed items in a batch write operation.

DynamoDB
while '[1]' in response and response['[1]']:
    response = client.batch_write_item(RequestItems=response['[1]'])
Drag options to blanks, or click blank then click option'
AProcessedItems
BUnprocessedItems
CItems
DBatchItems
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ProcessedItems' which will cause an infinite loop or no retry.
Using incorrect key names like 'Items' or 'BatchItems'.
3fill in blank
hard

Fix the error in the code that attempts to handle unprocessed items after a batch write.

DynamoDB
if response['[1]']:
    retry_items = response['UnprocessedItems']
Drag options to blanks, or click blank then click option'
AProcessedItems
BItems
CUnprocessedItems
DBatchItems
Attempts:
3 left
💡 Hint
Common Mistakes
Checking 'ProcessedItems' which does not exist in the response.
Using 'Items' or 'BatchItems' keys incorrectly.
4fill in blank
hard

Fill both blanks to correctly extract and retry unprocessed items in a batch write.

DynamoDB
unprocessed = response.get('[1]', {})
if unprocessed:
    response = client.batch_write_item(RequestItems=[2])
Drag options to blanks, or click blank then click option'
AUnprocessedItems
BProcessedItems
Cunprocessed
Dresponse['UnprocessedItems']
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ProcessedItems' instead of 'UnprocessedItems'.
Passing the wrong variable or expression to batch_write_item.
5fill in blank
hard

Fill all three blanks to implement a loop that retries unprocessed items until all are processed.

DynamoDB
while response.get('[1]'):
    unprocessed = response['[2]']
    response = client.batch_write_item(RequestItems=[3])
Drag options to blanks, or click blank then click option'
AUnprocessedItems
BProcessedItems
Cunprocessed
Dresponse['UnprocessedItems']
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ProcessedItems' which does not exist.
Passing the wrong argument to batch_write_item.
Not looping correctly to retry all unprocessed items.