简体   繁体   中英

DynamoDB Query on GSI with a list of values - Python

In my Dynamodb table of "batches" with partition key "ID" and "Created_at" as sort key and a GSI with "batch_Status".Given a list of statuses

let's say I would like to query the batches with status as "IN Progress", "NEW", "Completed"

Is there a way to query on GSI with a list of values?

I have done for a single value till now

def retrieve_records():
    response = table.query(IndexName="batch_Status-index", KeyConditionExpression=Key("batch_Status").eq("In Progress"))

Appreciate if you can provide a code snippet for list of values

Currently there is no way to have execute these queries in a single request. The only way to do this is to execute multiple queries. Latency delay should be minimal. It also gives you the opportunity to do them in parallel, which may speed things a bit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM