Complete the code to specify the parent ID attribute in the DynamoDB item.
item = {"id": "123", "[1]": "456"}In the adjacency list pattern, the parent ID is stored in an attribute typically named parentId.
Complete the code to query all items with a specific parent ID using DynamoDB's Query operation.
response = table.query(KeyConditionExpression=Key('parentId').[1]('456'))
The eq method is used to find items where the key equals a specific value.
Fix the error in the code to correctly insert a child node with a parent reference.
table.put_item(Item={"id": "789", "[1]": "123"})The attribute must be named parentId to correctly represent the parent in the adjacency list.
Fill both blanks to create a DynamoDB query that retrieves all children of a given parent ID.
response = table.query(KeyConditionExpression=Key('[1]').[2]('001'))
The query must use the parentId attribute with the eq method to find exact matches.
Fill all three blanks to create a dictionary comprehension that maps child IDs to their parent IDs from a list of items.
child_to_parent = {item['[1]']: item['[2]'] for item in items if item['[3]'] is not None}The dictionary maps each child's id to its parentId, filtering out items without a parent.