Reputation: 107
How can I make a query using more than one value? For example, all users with last_name ["Doggett","Scully","Mulder"]
Example using boto.
Table.create('users',
schema=[
HashKey('id') # defaults to STRING data_type
], throughput={
'read': 5,
'write': 15,
}, global_indexes=[
GlobalAllIndex('LastnameTimeIndex', parts=[
HashKey('last_name'),
RangeKey('creation_date', data_type=NUMBER),
],
throughput={
'read': 1,
'write': 1,
}),
],
connection=conn
)
something like:
table = Table("users", connections=conn)
table.query_2(last_name__in=["Doggett","Scully","Mulder"], connection=conn)
Upvotes: 2
Views: 815
Reputation: 862
Currently, the Query API doesn't support the IN condition as a KeyCondition. As suggested by Max, you'll need to make separate queries. You can also make the queries in parallel to improve performance.
If you want to use IN, you'll need to do a scan (or index scan in your example) instead.
Upvotes: 3