DynamoDB Java SDK query to match items in a list

Viewed 32

I'm trying to use SQL IN clause kind of feature in dynamoDB. I tried using withFilterExpression but I'm not sure how to do it. I looked at similar questions as they were too old. Is there a better method to do this? This is the segment of code I have got. I have used a static List as example but it is actually dynamic.

def getQuestionItems(conceptCode : String) = {

  val qIds = List("1","2","3")

  val querySpec = new QuerySpec()
  .withKeyConditionExpression("concept_id = :c_id")
  .withFilterExpression("question_id in :qIds") // obviously wrong
  .withValueMap(new ValueMap()
    .withString(":c_id", conceptCode));
 questionsTable.query(querySpec);
}

I need to pass qID list to fetch results similar to IN clause in SQL Query.

0 Answers
Related