melroyd16
melroyd16

Reputation: 85

Dynamo DB filter expression using IN operator with numeric array variable

I am trying to execute a query with the following payload

payload = {
        TableName : "fleet_list",
        IndexName : "vehicle_type-department-index",
        KeyConditionExpression : "vehicle_type = :v",
        FilterExpression : "(id IN (:list))",
        ExpressionAttributeValues : {
            ":v" : "Car",
            ":list" : [1947, 4397].join()
        }
    }

However the query does not work. it does work however if :list : 1947 . Any help will be appreciated

Upvotes: 1

Views: 1762

Answers (1)

ketan vijayvargiya
ketan vijayvargiya

Reputation: 5649

Try the following:

  • Change FilterExpression : "(id IN (:list))", to FilterExpression : "(id IN (:id1, :id2))",.
  • Change ":list" : [1947, 4397].join() to ":id1": 1947, ":id2": 4397.

Upvotes: 1

Related Questions