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
Corroded Metal vs Magical Armor, should it melt it?
Can the IPA represent all languages' tones?
Is there any way to stop a user from creating executables and running them?
How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?
Why does my purified Pokémon need to be healed?
What was the opinion of Kumarila and Prabhakara about the Puranas?
(A room / an office) where an artist works
What should I call bands of armed men in the Middle Ages?
Why are Tucker and Malcolm not dead?
Is this n-speak?
Why did Saruman lie?
Split phone numbers into groups based on first digit
Authors on the Credibility and Corruption of Modern Science
Super Duper Vdd stiffening required on 555 timer, what is the best way?
Does fossil fuels use since 1990 account for half of all the fossil fuels used in history?
Why is the result of ('b'+'a'+ + 'a' + 'a').toLowerCase() 'banana'?
Does Nightpack Ambusher's second ability trigger if I cast spells during the end step?
What are these funnel-looking green things in my yard?
How make an image of my entire usb flash drive?
My cat is a houdini
If clocks themselves are based on light signals, wouldn't we expect the measured speed of light to always be the same constant?
What are those bumps on top of the Antonov-225?
In which case does the Security misconfiguration vulnerability apply to?
crippling fear of hellfire &, damnation, please help?
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;
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
add a comment |
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
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
add a comment |
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
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
amazon-dynamodb dynamodb-queries
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
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
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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