DynamoDB : The provided key element does not match the schema

0 votes

Is there a way to get item depending on a field but not hashkey?

Example

My Table: id (HashKey) , name , email

How this can be done ??

I try this with boto :

user = users.get_item(email='john.doe@gmail.com')

I get the following error :

'The provided key element does not match the schema'

Nov 13, 2018 in AWS by findingbugs
• 3,140 points
726 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

The following applies to the Node.js AWS SDK in the AWS Lambda environment: 

I finally found a solution on the AWS forum: https://forums.aws.amazon.com/thread.jspa?threadID=208820

Inexplicably, the apparent solution conflicts with all AWS documentation that I can find.

Here is the code which worked for me:

var doc = require('dynamodb-doc');
var dynamo = new doc.DynamoDB();

var params = { }
params.TableName = "ExampleTable";
var key = { "ExampleHashKey": "1" };
params.Key = key;

dynamo.getItem(params, function(err, data) {
    if (err)
        console.log(err);
    else
        console.log(data)
});
answered Nov 13, 2018 by Priyaj
• 56,100 points

Related Questions In AWS

0 votes
1 answer
+1 vote
2 answers
0 votes
1 answer

Error creating Key Pair: You are not authorized to perform this operation

Try adding AmazonEC2FullAccess policy. If you are not sure how ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 56,100 points
173 views
0 votes
1 answer

Trying to Determine Amazon EC2 instance creation date/time

You can't find as such attribute called ...READ MORE

answered May 29, 2018 in AWS by Flying geek
• 3,130 points
1,177 views
0 votes
1 answer

How to launch and configure an EMR cluster using boto

Boto and the underlying EMR API is ...READ MORE

answered Sep 12, 2018 in AWS by Priyaj
• 56,100 points
567 views
0 votes
1 answer
+3 votes
3 answers

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.