0
0
DynamoDBquery~10 mins

DELETE expression for set removal 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 remove an element from a set attribute using the DELETE expression.

DynamoDB
UpdateExpression = "DELETE tags [1] :tagToRemove"
Drag options to blanks, or click blank then click option'
AADD
BREMOVE
CDELETE
DSET
Attempts:
3 left
💡 Hint
Common Mistakes
Using REMOVE instead of DELETE for set removal.
Using ADD which adds elements instead of removing.
2fill in blank
medium

Complete the code to define the value to remove from the set in ExpressionAttributeValues.

DynamoDB
ExpressionAttributeValues = {":tagToRemove": [1]
Drag options to blanks, or click blank then click option'
A{"tag1"}
Bset(["tag1"])
C{"tag1"}
Dset(["tag1"])
Attempts:
3 left
💡 Hint
Common Mistakes
Using curly braces {} which define a dictionary, not a set.
Using a string instead of a set.
3fill in blank
hard

Complete the UpdateExpression to correctly remove 'tag1' from the 'tags' set attribute.

DynamoDB
UpdateExpression = "DELETE [1] :tagToRemove"
Drag options to blanks, or click blank then click option'
Atags +
Btags -
Ctags
Dtags ,
Attempts:
3 left
💡 Hint
Common Mistakes
Adding + or - between attribute and value which causes syntax errors.
Using a comma instead of a space separator.
4fill in blank
hard

Fill both blanks to complete the UpdateExpression and ExpressionAttributeValues to remove 'tag2' from 'tags'.

DynamoDB
UpdateExpression = "[1] tags :tagToRemove"
ExpressionAttributeValues = {":tagToRemove": [2]
Drag options to blanks, or click blank then click option'
ADELETE
BREMOVE
Cset(["tag2"])
D["tag2"]
Attempts:
3 left
💡 Hint
Common Mistakes
Using REMOVE instead of DELETE.
Using a list instead of a set for the value.
5fill in blank
hard

Fill all three blanks to write a complete update call that removes 'tag3' from the 'tags' set attribute.

DynamoDB
response = client.update_item(
    TableName=[1],
    Key=[2],
    UpdateExpression="DELETE tags :tagToRemove",
    ExpressionAttributeValues=[3]
)
Drag options to blanks, or click blank then click option'
A"MyTable"
B{"id": {"S": "123"}}
C{":tagToRemove": {"SS": ["tag3"]}}
D"tags"
Attempts:
3 left
💡 Hint
Common Mistakes
Using Python set syntax instead of DynamoDB JSON format in ExpressionAttributeValues.
Incorrect Key format or missing quotes around TableName.