Bird
0
0

In a Step Functions workflow, a Task state calls DynamoDB UpdateItem with this Parameters snippet:

medium📝 query result Q5 of 15
DynamoDB - with Serverless
In a Step Functions workflow, a Task state calls DynamoDB UpdateItem with this Parameters snippet:
{
  "TableName": "Orders",
  "Key": { "OrderId": { "S": "order789" } },
  "UpdateExpression": "SET #st = :newStatus",
  "ExpressionAttributeNames": { "#st": "Status" },
  "ExpressionAttributeValues": { ":newStatus": { "S": "Shipped" } }
}

What will this operation do?
AChange the Status attribute of order789 to 'Shipped'
BDelete the order789 item from the Orders table
CAdd a new item with OrderId 'order789' and Status 'Shipped'
DReturn an error because UpdateExpression is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand UpdateItem parameters

    UpdateExpression sets the attribute 'Status' to 'Shipped' for the given key.
  2. Step 2: Confirm no syntax errors

    ExpressionAttributeNames and Values are correctly defined; syntax is valid.
  3. Final Answer:

    Change the Status attribute of order789 to 'Shipped' -> Option A
  4. Quick Check:

    UpdateItem with SET changes attribute value [OK]
Quick Trick: UpdateExpression with SET updates attribute value [OK]
Common Mistakes:
MISTAKES
  • Confusing UpdateItem with DeleteItem
  • Thinking it adds a new item instead of updating
  • Misunderstanding ExpressionAttributeNames usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes