Unable to use IN operator in DynamoDb Querydynamo db error Invalid ProjectionExpression: An expression attribute name used in the document path is not defined; attribute name: #PIs Composite Primary Key in DynamoDB for QueryQuerying DynamoDB without Primary KeyPartition in DynamodbQuerying for DynamoDB items using “contains”DynamoDB query secondary index ValidationException: Condition parameter type does not match schema typeDynamoDB Partition Designbest strategy to query items from dynamodbDynamoDB - simple explanationUsing nested fields in the projection of a DynamoDB GSI

How to derive this identity

How big are the Choedan Kal?

Does Nightpack Ambusher's second ability trigger if I cast spells during the end step?

Why command hierarchy, if the chain of command is standing next to each other?

Are there any other rule mechanics that could grant Thieves' Cant?

Can sampling rate be a floating point number?

Do Reform Jews believe in a theistic God?

Escape Velocity - Won't the orbital path just become larger with higher initial velocity?

Website error: "Walmart can’t use this browser"

Flood on the top floor

Can renaming a method preserve encapsulation?

Why are Tucker and Malcolm not dead?

If "more guns less crime", how do gun advocates explain that the EU has less crime than the US?

Can the IPA represent all languages' tones?

The cat exchanges places with a drawing of the cat

How would timezones work on a planet 100 times the size of our Earth

Should I email my professor about a recommendation letter if he has offered me a job?

Generate Brainfuck for the numbers 1–255

Telephone number in spoken words

A torrent of foreign terms

How far did Gandalf and the Balrog drop from the bridge in Moria?

Corroded Metal vs Magical Armor, should it melt it?

Why does my purified Pokémon need to be healed?

Is this n-speak?



Unable to use IN operator in DynamoDb Query


dynamo db error Invalid ProjectionExpression: An expression attribute name used in the document path is not defined; attribute name: #PIs Composite Primary Key in DynamoDB for QueryQuerying DynamoDB without Primary KeyPartition in DynamodbQuerying for DynamoDB items using “contains”DynamoDB query secondary index ValidationException: Condition parameter type does not match schema typeDynamoDB Partition Designbest strategy to query items from dynamodbDynamoDB - simple explanationUsing nested fields in the projection of a DynamoDB GSI






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















The problem is I am getting error (Filter Expression can only contain non-primary key attributes: Primary key attribute: name).
tenant is my Primary Partition Key and name is my Primary Sort Key.



I need to write something equivalent to this in dynamo db:
Select * from projects where tenant = 'testProject' and name in ('John','Dave').



query = 
TableName: 'projects',
ExpressionAttributeNames:
'#tenant': 'tenant',
'#name' : 'name'
,
ExpressionAttributeValues:
":tenant": 'testProject',
":user1" : "John",
":user2" : "Dave"
,
KeyConditionExpression: '#tenant = :tenant',
FilterExpression: '#name IN (:user1,:user2)'
;









share|improve this question


























  • Is this a copy of the code used? I see you have backticks on projects in TableName. Is this correct?

    – kometen
    Mar 27 at 10:29






  • 1





    I have corrected it. Now it is the copy of the actual code.

    – Shikher Garg
    Mar 27 at 10:38

















0















The problem is I am getting error (Filter Expression can only contain non-primary key attributes: Primary key attribute: name).
tenant is my Primary Partition Key and name is my Primary Sort Key.



I need to write something equivalent to this in dynamo db:
Select * from projects where tenant = 'testProject' and name in ('John','Dave').



query = 
TableName: 'projects',
ExpressionAttributeNames:
'#tenant': 'tenant',
'#name' : 'name'
,
ExpressionAttributeValues:
":tenant": 'testProject',
":user1" : "John",
":user2" : "Dave"
,
KeyConditionExpression: '#tenant = :tenant',
FilterExpression: '#name IN (:user1,:user2)'
;









share|improve this question


























  • Is this a copy of the code used? I see you have backticks on projects in TableName. Is this correct?

    – kometen
    Mar 27 at 10:29






  • 1





    I have corrected it. Now it is the copy of the actual code.

    – Shikher Garg
    Mar 27 at 10:38













0












0








0


1






The problem is I am getting error (Filter Expression can only contain non-primary key attributes: Primary key attribute: name).
tenant is my Primary Partition Key and name is my Primary Sort Key.



I need to write something equivalent to this in dynamo db:
Select * from projects where tenant = 'testProject' and name in ('John','Dave').



query = 
TableName: 'projects',
ExpressionAttributeNames:
'#tenant': 'tenant',
'#name' : 'name'
,
ExpressionAttributeValues:
":tenant": 'testProject',
":user1" : "John",
":user2" : "Dave"
,
KeyConditionExpression: '#tenant = :tenant',
FilterExpression: '#name IN (:user1,:user2)'
;









share|improve this question
















The problem is I am getting error (Filter Expression can only contain non-primary key attributes: Primary key attribute: name).
tenant is my Primary Partition Key and name is my Primary Sort Key.



I need to write something equivalent to this in dynamo db:
Select * from projects where tenant = 'testProject' and name in ('John','Dave').



query = 
TableName: 'projects',
ExpressionAttributeNames:
'#tenant': 'tenant',
'#name' : 'name'
,
ExpressionAttributeValues:
":tenant": 'testProject',
":user1" : "John",
":user2" : "Dave"
,
KeyConditionExpression: '#tenant = :tenant',
FilterExpression: '#name IN (:user1,:user2)'
;






amazon-dynamodb dynamodb-queries






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 11:21







Shikher Garg

















asked Mar 27 at 10:14









Shikher GargShikher Garg

22 bronze badges




22 bronze badges















  • Is this a copy of the code used? I see you have backticks on projects in TableName. Is this correct?

    – kometen
    Mar 27 at 10:29






  • 1





    I have corrected it. Now it is the copy of the actual code.

    – Shikher Garg
    Mar 27 at 10:38

















  • Is this a copy of the code used? I see you have backticks on projects in TableName. Is this correct?

    – kometen
    Mar 27 at 10:29






  • 1





    I have corrected it. Now it is the copy of the actual code.

    – Shikher Garg
    Mar 27 at 10:38
















Is this a copy of the code used? I see you have backticks on projects in TableName. Is this correct?

– kometen
Mar 27 at 10:29





Is this a copy of the code used? I see you have backticks on projects in TableName. Is this correct?

– kometen
Mar 27 at 10:29




1




1





I have corrected it. Now it is the copy of the actual code.

– Shikher Garg
Mar 27 at 10:38





I have corrected it. Now it is the copy of the actual code.

– Shikher Garg
Mar 27 at 10:38












1 Answer
1






active

oldest

votes


















0














As of the day that I am writing this, you cannot use IN in your key condition expression, nor can you include a key attribute in your filter expression.



The way to do what you’re wanting to do is with a BatchGetItem request, which allows you to specify the full primary key for multiple items.






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',
    autoActivateHeartbeat: false,
    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%2f55374716%2funable-to-use-in-operator-in-dynamodb-query%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









    0














    As of the day that I am writing this, you cannot use IN in your key condition expression, nor can you include a key attribute in your filter expression.



    The way to do what you’re wanting to do is with a BatchGetItem request, which allows you to specify the full primary key for multiple items.






    share|improve this answer





























      0














      As of the day that I am writing this, you cannot use IN in your key condition expression, nor can you include a key attribute in your filter expression.



      The way to do what you’re wanting to do is with a BatchGetItem request, which allows you to specify the full primary key for multiple items.






      share|improve this answer



























        0












        0








        0







        As of the day that I am writing this, you cannot use IN in your key condition expression, nor can you include a key attribute in your filter expression.



        The way to do what you’re wanting to do is with a BatchGetItem request, which allows you to specify the full primary key for multiple items.






        share|improve this answer













        As of the day that I am writing this, you cannot use IN in your key condition expression, nor can you include a key attribute in your filter expression.



        The way to do what you’re wanting to do is with a BatchGetItem request, which allows you to specify the full primary key for multiple items.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 1 at 4:51









        Matthew PopeMatthew Pope

        2,8901 gold badge8 silver badges22 bronze badges




        2,8901 gold badge8 silver badges22 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55374716%2funable-to-use-in-operator-in-dynamodb-query%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

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript