0
0
DynamoDBquery~10 mins

Fine-grained access control 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 specify the partition key in the DynamoDB query.

DynamoDB
KeyConditionExpression = Key('[1]').eq('User123')
Drag options to blanks, or click blank then click option'
AUserId
BTimestamp
CEmail
DStatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-key attribute in the KeyConditionExpression causes errors.
Confusing sort key with partition key.
2fill in blank
medium

Complete the code to add a filter expression that restricts access to items with status 'active'.

DynamoDB
FilterExpression = Attr('status').[1]('active')
Drag options to blanks, or click blank then click option'
Aneq
Bcontains
Ceq
Dbegins_with
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'neq' will exclude active items instead of including them.
Using 'contains' or 'begins_with' is for partial matches, not exact.
3fill in blank
hard

Fix the error in the condition expression to check if the attribute 'role' is 'admin'.

DynamoDB
KeyConditionExpression = Key('UserId').eq('User123') & Key('[1]').eq('admin')
Drag options to blanks, or click blank then click option'
Arole
BRole
CuserRole
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect case for attribute names causes the query to fail.
Using a non-key attribute in KeyConditionExpression causes errors.
4fill in blank
hard

Fill in the blanks to create a filter expression that allows only items where 'department' is 'sales' and 'accessLevel' is greater than 3.

DynamoDB
FilterExpression = Attr('[1]').eq('sales') & Attr('[2]').[3](3)
Drag options to blanks, or click blank then click option'
Adepartment
BaccessLevel
Cgt
Dlt
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'lt' instead of 'gt' reverses the intended condition.
Mixing attribute names or using incorrect case.
5fill in blank
hard

Fill in the blanks to build a filter expression that filters items where 'UserId' equals 'User123', 'status' is 'active', and 'lastLogin' is after 2023-01-01.

DynamoDB
FilterExpression = Attr('[1]').eq('User123') & Attr('[2]').eq('active') & Attr('[3]').[4]('2023-01-01')
Drag options to blanks, or click blank then click option'
AUserId
Bstatus
ClastLogin
Dgt
Attempts:
3 left
💡 Hint
Common Mistakes
Using Key instead of Attr for partition key causes errors.
Using 'lt' instead of 'gt' for date comparison reverses logic.