0
0
DynamoDBquery~10 mins

Transaction vs batch comparison in DynamoDB - Interactive Practice

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

Complete the code to start a DynamoDB transaction.

DynamoDB
response = client.[1](TransactItems=items)
Drag options to blanks, or click blank then click option'
Atransact_write_items
Bput_item
Cupdate_item
Dbatch_write_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using batch_write_item instead of transact_write_items for transactions.
Trying to use put_item for multiple atomic operations.
2fill in blank
medium

Complete the code to batch write multiple items to DynamoDB.

DynamoDB
response = client.[1](RequestItems=request_items)
Drag options to blanks, or click blank then click option'
Aput_item
Btransact_write_items
Cbatch_write_item
Ddelete_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using transact_write_items when only batch write is needed.
Confusing batch_write_item with put_item which writes a single item.
3fill in blank
hard

Fix the error in the transaction code by choosing the correct parameter name.

DynamoDB
response = client.transact_write_items([1]=items)
Drag options to blanks, or click blank then click option'
ARequestItems
BTransactItems
CBatchItems
DItems
Attempts:
3 left
💡 Hint
Common Mistakes
Using RequestItems instead of TransactItems in transaction calls.
Using generic parameter names like Items or BatchItems.
4fill in blank
hard

Fill both blanks to create a batch write request with multiple items.

DynamoDB
response = client.[1](RequestItems=[2])
Drag options to blanks, or click blank then click option'
Abatch_write_item
Btransact_write_items
C{'TableName': [{'PutRequest': {'Item': item}}]}
D{'TableName': [{'DeleteRequest': {'Key': key}}]}
Attempts:
3 left
💡 Hint
Common Mistakes
Using transact_write_items for batch operations.
Incorrectly formatting the RequestItems dictionary.
5fill in blank
hard

Fill all three blanks to create a transaction with a condition check and an update.

DynamoDB
response = client.transact_write_items(TransactItems=[{'ConditionCheck': {'TableName': [1], 'Key': [2], 'ConditionExpression': [3], {'Update': {'TableName': 'Orders', 'Key': {'OrderId': {'S': '123'}}, 'UpdateExpression': 'SET #st = :val', 'ExpressionAttributeNames': {'#st': 'Status'}, 'ExpressionAttributeValues': {':val': {'S': 'SHIPPED'}}}}])
Drag options to blanks, or click blank then click option'
A'Users'
B{'UserId': {'S': 'abc'}}
C'attribute_exists(UserId)'
D'Orders'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong table names or keys in the condition check.
Missing or incorrect condition expressions.