0
0
DynamoDBquery~10 mins

PutItem (creating items) 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 put an item into the DynamoDB table.

DynamoDB
response = table.[1](Item={'UserId': '123', 'Name': 'Alice'})
Drag options to blanks, or click blank then click option'
Aget_item
Bdelete_item
Cput_item
Dupdate_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using get_item instead of put_item will only retrieve data, not create it.
Using delete_item will remove an item, not add one.
2fill in blank
medium

Complete the code to specify the table name when creating a DynamoDB resource.

DynamoDB
table = dynamodb.Table('[1]')
Drag options to blanks, or click blank then click option'
AUserTable
Bput_item
CItem
D123
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names or keywords instead of the actual table name.
Using numbers instead of the table name string.
3fill in blank
hard

Fix the error in the code to correctly put an item with a numeric attribute.

DynamoDB
response = table.put_item(Item={'UserId': '123', 'Age': [1])
Drag options to blanks, or click blank then click option'
A25
B'twenty-five'
C'25'
D"25"
Attempts:
3 left
💡 Hint
Common Mistakes
Passing numbers as strings causes DynamoDB to treat them as strings.
Using words instead of numeric values.
4fill in blank
hard

Fill both blanks to put an item with a string and a list attribute.

DynamoDB
response = table.put_item(Item={'UserId': '[1]', 'Tags': [2])
Drag options to blanks, or click blank then click option'
Auser123
B['tag1', 'tag2']
D['tag1', tag2]
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the UserId string.
Using invalid list syntax for Tags.
5fill in blank
hard

Fill all three blanks to put an item with a nested map attribute.

DynamoDB
response = table.put_item(Item={'UserId': '[1]', 'Profile': [2], 'Active': [3])
Drag options to blanks, or click blank then click option'
Auser456
B{'Name': 'Bob', 'Age': 30}
CTrue
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes for UserId string.
Using incorrect syntax for the nested map.
Using string 'true' instead of boolean True.