0
0
DynamoDBquery~10 mins

Boto3 (Python) client vs resource in DynamoDB - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a DynamoDB client using Boto3.

DynamoDB
import boto3
client = boto3.[1]('dynamodb')
Drag options to blanks, or click blank then click option'
Aconnect
Bresource
Cclient
Dsession
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'resource' instead of 'client' creates a higher-level object, not a client.
Using 'session' or 'connect' are not valid boto3 methods for this purpose.
2fill in blank
medium

Complete the code to create a DynamoDB resource using Boto3.

DynamoDB
import boto3
resource = boto3.[1]('dynamodb')
Drag options to blanks, or click blank then click option'
Aresource
Bconnect
Cclient
Dsession
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'client' instead of 'resource' creates a low-level client.
Using 'session' or 'connect' are not valid boto3 methods here.
3fill in blank
hard

Fix the error in the code to get a DynamoDB table using the resource.

DynamoDB
table = resource.Table([1])
Drag options to blanks, or click blank then click option'
A'MyTable'
B123
CMyTable
Dtable_name
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the table name causes a NameError.
Using a number instead of a string is invalid.
4fill in blank
hard

Fill both blanks to put an item into a DynamoDB table using the client.

DynamoDB
response = client.[1](TableName=[2], Item={'id': {'S': '123'}})
Drag options to blanks, or click blank then click option'
Aput_item
Bget_item
CMyTable
D'MyTable'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'get_item' instead of 'put_item' does not insert data.
Not quoting the table name causes an error.
5fill in blank
hard

Fill all three blanks to get an item from a DynamoDB table using the resource.

DynamoDB
response = table.[1](Key=[2])
item = response.get([3])
Drag options to blanks, or click blank then click option'
Aget_item
B{'id': '123'}
C'Item'
Dput_item
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'put_item' instead of 'get_item' is wrong here.
Passing the key as a string instead of a dictionary causes errors.
Accessing the response with the wrong key name.