Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
229 views
in Technique[技术] by (71.8m points)

aws cloud9 - I wonder how to retrieve multiple items from this code

I am so beginner. I have studied AWS and got a some question.

https://aws.amazon.com/ko/getting-started/hands-on/create-manage-nonrelational-database-dynamodb/3/

import boto3 from boto3.dynamodb.conditions import Key

boto3 is the AWS SDK library for Python.

The "resources" interface allows for a higher-level abstraction than the low-level client interface.

For more details, go to http://boto3.readthedocs.io/en/latest/guide/resources.html

dynamodb = boto3.resource('dynamodb', region_name='us-east-1') table = dynamodb.Table('Books')

When making a Query API call, we use the KeyConditionExpression parameter to specify the hash key on which we want to query.

We're using the Key object from the Boto3 library to specify that we want the attribute name ("Author")

to equal "John Grisham" by using the ".eq()" method.

resp = table.query(KeyConditionExpression=Key('Author').eq("John Grisham"))

print("The query returned the following items:") for item in resp['Items']: print(item)

In this page, they gave me example code. And, I wonder how to retrieve multiple items from this code. I understand resp = table.query(KeyConditionExpression=Key('Author').eq('John Grisham'))

this code is meaning for 'finding Author = Grisham '

I tried to modify it but, couldn't do .. so Can you help me...?

question from:https://stackoverflow.com/questions/66059027/i-wonder-how-to-retrieve-multiple-items-from-this-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...