0
0
DynamoDBquery~10 mins

BatchWriteItem 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 specify the DynamoDB table name in the BatchWriteItem request.

DynamoDB
batch_write_params = {
    'RequestItems': {
        '[1]': []
    }
}
Drag options to blanks, or click blank then click option'
ATableName
BMyTable
CItems
DRequestItems
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'TableName' or 'Items' as the key instead of the actual table name.
Using 'RequestItems' as the key inside 'RequestItems'.
2fill in blank
medium

Complete the code to add a PutRequest with an item containing 'id' and 'name' attributes.

DynamoDB
batch_write_params = {
    'RequestItems': {
        'MyTable': [
            {'[1]': {'Item': {'id': {'S': '123'}, 'name': {'S': 'Alice'}}}}
        ]
    }
}
Drag options to blanks, or click blank then click option'
ADeleteRequest
BUpdateRequest
CPutRequest
DWriteRequest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'DeleteRequest' when trying to add an item.
Using 'UpdateRequest' which is not valid in BatchWriteItem.
3fill in blank
hard

Fix the error in the BatchWriteItem call by completing the missing parameter name.

DynamoDB
response = dynamodb.[1](RequestItems=batch_write_params['RequestItems'])
Drag options to blanks, or click blank then click option'
Aput_item
Bbatch_write
Cwrite_batch
Dbatch_write_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'put_item' which only writes one item.
Using 'write_batch' or 'batch_write' which are not valid method names.
4fill in blank
hard

Fill both blanks to add a DeleteRequest for an item with primary key 'id' equal to '456'.

DynamoDB
batch_write_params = {
    'RequestItems': {
        'MyTable': [
            {'[1]': {'Key': {'id': {'S': '[2]'}}}}
        ]
    }
}
Drag options to blanks, or click blank then click option'
ADeleteRequest
BPutRequest
C123
D456
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'PutRequest' instead of 'DeleteRequest' for deletion.
Using the wrong id value.
5fill in blank
hard

Fill all three blanks to create a BatchWriteItem request with one PutRequest and one DeleteRequest.

DynamoDB
batch_write_params = {
    'RequestItems': {
        'MyTable': [
            {'[1]': {'Item': {'id': {'S': '789'}, 'name': {'S': 'Bob'}}}},
            {'[2]': {'Key': {'id': {'S': '[3]'}}}}
        ]
    }
}
Drag options to blanks, or click blank then click option'
APutRequest
BDeleteRequest
C101
D202
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up PutRequest and DeleteRequest.
Using an incorrect id value for deletion.