Emily Chu
Emily Chu

Reputation: 187

DynamoDB Error: "Query key condition not supported"

I am querying data from a database in aws dynamodb and experiencing an error message on the KeyConditionExpression.

I am querying for "dominant_temporality" and "dt". These make up my composite partition key - dt is unique for each row and my sort key.

The code I'm running:

var params = {
    TableName : "deardiary",
    KeyConditionExpression: "#d = :dominant_temporality and dt between :minDate and :maxDate",
    ExpressionAttributeNames: { 
        "#d" : "temporality"
    },
    ExpressionAttributeValues: { // the query values
        ":dominant_temporality": {S: "present"},
        ":minDate": {N: new Date("October 8, 2018").valueOf().toString()},
        ":maxDate": {N: new Date("October 9, 2018").valueOf().toString()}
    }
};

Upvotes: 3

Views: 4778

Answers (1)

guzial
guzial

Reputation: 161

Check if you are using BETWEEN on HASH which is not allowed - you can use only EQ for HASH or begins_with for range key.

Upvotes: 1

Related Questions