Reputation: 321
I have a table named products. It’s schema is
I want to query similar to
SELECT * FROM products WHERE CustomerNumber IN ("cust123","cust234").
How to achieve it?
Few observations -
DynamoDBQueryExpression would query only on index/hashKey not not on list of hashKeys like in example above.
Also DynamoDBQueryExpression doesnt support IN , OR operator.
Also BatchLoad uses only Primary Key (in my case customerNumber and productID)record to return batch of records.
Also ,I dont want to scan the table and apply filter on it.
Also creating GSI on customerNumber and then querying it didn't work
Upvotes: 2
Views: 2232
Reputation: 7669
Instead of select * where partitionkey IN ...
you would do a separate query equivalent to select * where partitionkey= ...
for each value of your IN
condition. It costs you a few extra round trips on the network, but that’s all; if you’re concerned about speed you can execute the individual queries in parallel.
Upvotes: 6