0
0
DynamoDBquery~10 mins

UpdateItem basics 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 table name for the UpdateItem operation.

DynamoDB
response = client.update_item(TableName='[1]', Key=key, UpdateExpression=update_expr)
Drag options to blanks, or click blank then click option'
AItem
BUpdateExpression
CUsers
DKey
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Key' or 'Item' instead of the table name.
Confusing UpdateExpression with TableName.
2fill in blank
medium

Complete the code to specify the key attribute name for the item to update.

DynamoDB
key = {'UserId': {'S': [1]
Drag options to blanks, or click blank then click option'
AUserId
B'123'
C'UpdateExpression'
D'Item'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the attribute name instead of its value.
Omitting quotes around the string value.
3fill in blank
hard

Fix the error in the UpdateExpression syntax to set the 'Age' attribute.

DynamoDB
update_expr = 'SET Age = [1]'
Drag options to blanks, or click blank then click option'
A:newAge
B#Age
CnewAge
DAge
Attempts:
3 left
💡 Hint
Common Mistakes
Using the attribute name directly instead of a placeholder.
Omitting the colon before the placeholder.
4fill in blank
hard

Fill both blanks to define ExpressionAttributeValues for setting Age to 30.

DynamoDB
expr_attr_values = { [1]: {'N': [2] }
Drag options to blanks, or click blank then click option'
A{':newAge'}
B'30'
C':newAge'
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Using curly braces incorrectly around keys.
Using number 30 without quotes.
5fill in blank
hard

Fill all three blanks to complete the UpdateItem call with table name, key, and update expression.

DynamoDB
response = client.update_item(TableName=[1], Key=[2], UpdateExpression=[3])
Drag options to blanks, or click blank then click option'
A'Users'
B{'UserId': {'S': '123'}}
C'SET Age = :newAge'
D'Age'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing quotes around TableName or UpdateExpression.
Incorrect Key dictionary format.