Challenge - 5 Problems
TransactGetItems Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Output of a TransactGetItems with two valid keys
Given a DynamoDB table named Users with primary key
UserId, what is the output of the following TransactGetItems request?DynamoDB
TransactGetItems({
TransactItems: [
{ Get: { TableName: "Users", Key: { UserId: { S: "user1" } } } },
{ Get: { TableName: "Users", Key: { UserId: { S: "user2" } } } }
]
})Attempts:
2 left
💡 Hint
TransactGetItems allows multiple Get operations in one atomic request.
✗ Incorrect
TransactGetItems returns all requested items atomically. Each Get operation fetches the item by key, so the output is an array with each item data.
🧠 Conceptual
intermediate1:30remaining
Understanding atomicity in TransactGetItems
Which statement best describes the atomicity behavior of TransactGetItems in DynamoDB?
Attempts:
2 left
💡 Hint
Think about what atomic means in database transactions.
✗ Incorrect
TransactGetItems ensures that all requested items are retrieved in a single atomic operation, so either all items are returned or none if any fail.
📝 Syntax
advanced2:00remaining
Identify the syntax error in this TransactGetItems request
Which option contains a syntax error that will cause the TransactGetItems request to fail?
DynamoDB
TransactGetItems({
TransactItems: [
{ Get: { TableName: "Products", Key: { ProductId: { N: "101" } } } },
{ Get: { TableName: "Products", Key: { ProductId: 102 } } }
]
})Attempts:
2 left
💡 Hint
DynamoDB requires attribute values to specify their data types explicitly.
✗ Incorrect
In DynamoDB requests, attribute values must be wrapped with their data type (e.g., { N: "102" }). The second Get operation misses this, causing a syntax error.
❓ optimization
advanced2:00remaining
Optimizing multiple item retrieval with TransactGetItems
You need to retrieve 10 items from the same DynamoDB table by their keys. Which approach is the most efficient and atomic?
Attempts:
2 left
💡 Hint
Consider atomicity and number of network calls.
✗ Incorrect
TransactGetItems allows multiple Get operations in one atomic request, ensuring all items are retrieved together with a single network call.
🔧 Debug
expert2:30remaining
Diagnose the error from a TransactGetItems request with a missing key attribute
A TransactGetItems request fails with a ValidationException. The request is:
DynamoDB
TransactGetItems({
TransactItems: [
{ Get: { TableName: "Orders", Key: { OrderId: { S: "123" } } } },
{ Get: { TableName: "Orders", Key: { } } }
]
})Attempts:
2 left
💡 Hint
Check if all Get operations specify a valid key.
✗ Incorrect
Each Get operation must specify a complete key. An empty Key object is invalid and causes a ValidationException.