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,260 points
32,398 views

1 answer to this question.

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
• 58,020 points

Related Questions In AWS

0 votes
0 answers
0 votes
1 answer

Why I saw in the aws s3 glacier vault the size does not match with asw s3 glacier client

Hi, I am not sure, but the client ...READ MORE

answered Jun 29, 2020 in AWS by MD
• 95,460 points
1,042 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,280 points
9,764 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
• 58,020 points
4,897 views
0 votes
1 answer
+3 votes
3 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP