1

Is there any way to query a dynamodb table with multiple values for a single attribute?

      TableName: "sdfdsgfdg"
      IndexName: 'username-category-index',
      KeyConditions: {
        "username": {
          "AttributeValueList": { "S": "[email protected]" }
          ,
          "ComparisonOperator": "EQ"
        },
        "username": {
          "AttributeValueList": { "S": "[email protected]" }
          ,
          "ComparisonOperator": "EQ"
        },
        "category": {
          "AttributeValueList": { "S": "Coupon" }
          ,
          "ComparisonOperator": "EQ"
        }
      }

1 Answer 1

2

BachGetItem API can be used to get multiple items from DynamoDB table. However, it can't be used in your use case as you are getting the data from index.

The BatchGetItem operation returns the attributes of one or more items from one or more tables. You identify requested items by primary key.

In API perspective, there is no other solution. You may need to look at data modelling perspective and design the table/index to satisfy your Query Access Pattern (QAP).

Also, please note that querying the index multiple times with partition key values (i.e. some small number) wouldn't impact the performance as long as it is handful of items.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.