Complete the code to delete an item from the DynamoDB table named 'Users' using the primary key 'UserId'.
response = table.delete_item(Key={'UserId': [1])The key value must be a string matching the primary key value. Here, '123' is the correct string format.
Complete the code to delete an item from the 'Products' table where the primary key 'ProductId' equals 456.
response = dynamodb.Table('Products').delete_item(Key=[1])
The key dictionary must use the correct primary key name and the value type must match the table schema. Here, 456 is a number, so no quotes.
Fix the error in the code to delete an item from the 'Orders' table with 'OrderId' 789.
response = table.delete_item(Key=[1])The key dictionary must have the attribute name as a string matching the exact case and the value type matching the schema. 'OrderId' with integer 789 is correct.
Fill both blanks to delete an item from the 'Employees' table where 'EmployeeId' is 101 and return all old attributes.
response = table.delete_item(Key=[1], ReturnValues=[2])
The Key must be a dictionary with the correct attribute and value. ReturnValues must be the string 'ALL_OLD' to get the old item back.
Fill all three blanks to delete an item from the 'Books' table with 'ISBN' '978-3-16-148410-0', conditionally only if 'InStock' is true, and return the old attributes.
response = table.delete_item(Key=[1], ConditionExpression=[2], ReturnValues=[3])
The Key must be a dictionary with the ISBN string. ConditionExpression uses the Attr helper with eq(True) to check InStock. ReturnValues must be 'ALL_OLD' as a string.