DynamoDB Error: “Query key condition not supported”











up vote
1
down vote

favorite












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()}
}
};









share|improve this question
























  • You need to check what your table partition key and range keys are. Is dt your range key?
    – Stu
    Nov 17 at 21:37










  • Yes - it is what I am trying to sort the entries on
    – Emily Chu
    Nov 17 at 23:22












  • You can't query by sort key in keyConditionExpression. Please check my answer here : stackoverflow.com/questions/53167165/…
    – IftekharDani
    yesterday















up vote
1
down vote

favorite












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()}
}
};









share|improve this question
























  • You need to check what your table partition key and range keys are. Is dt your range key?
    – Stu
    Nov 17 at 21:37










  • Yes - it is what I am trying to sort the entries on
    – Emily Chu
    Nov 17 at 23:22












  • You can't query by sort key in keyConditionExpression. Please check my answer here : stackoverflow.com/questions/53167165/…
    – IftekharDani
    yesterday













up vote
1
down vote

favorite









up vote
1
down vote

favorite











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()}
}
};









share|improve this question















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()}
}
};






nosql amazon-dynamodb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 at 17:04

























asked Nov 17 at 19:52









Emily Chu

718




718












  • You need to check what your table partition key and range keys are. Is dt your range key?
    – Stu
    Nov 17 at 21:37










  • Yes - it is what I am trying to sort the entries on
    – Emily Chu
    Nov 17 at 23:22












  • You can't query by sort key in keyConditionExpression. Please check my answer here : stackoverflow.com/questions/53167165/…
    – IftekharDani
    yesterday


















  • You need to check what your table partition key and range keys are. Is dt your range key?
    – Stu
    Nov 17 at 21:37










  • Yes - it is what I am trying to sort the entries on
    – Emily Chu
    Nov 17 at 23:22












  • You can't query by sort key in keyConditionExpression. Please check my answer here : stackoverflow.com/questions/53167165/…
    – IftekharDani
    yesterday
















You need to check what your table partition key and range keys are. Is dt your range key?
– Stu
Nov 17 at 21:37




You need to check what your table partition key and range keys are. Is dt your range key?
– Stu
Nov 17 at 21:37












Yes - it is what I am trying to sort the entries on
– Emily Chu
Nov 17 at 23:22






Yes - it is what I am trying to sort the entries on
– Emily Chu
Nov 17 at 23:22














You can't query by sort key in keyConditionExpression. Please check my answer here : stackoverflow.com/questions/53167165/…
– IftekharDani
yesterday




You can't query by sort key in keyConditionExpression. Please check my answer here : stackoverflow.com/questions/53167165/…
– IftekharDani
yesterday












1 Answer
1






active

oldest

votes

















up vote
0
down vote













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.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53354971%2fdynamodb-error-query-key-condition-not-supported%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    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.






    share|improve this answer

























      up vote
      0
      down vote













      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.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        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.






        share|improve this answer












        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        guzial

        6312




        6312






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53354971%2fdynamodb-error-query-key-condition-not-supported%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Ottavio Pratesi

            Tricia Helfer

            15 giugno