Skip to content
Advertisement

How to use DynamoDB batchGet command

I created a “Movie” DynamoDB table from AWS DynamoDB tutorial posted at

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Js.01.html

with the attribute below:

JavaScript

Now I want to use the batchGet command:

JavaScript

And running it with:

JavaScript

But I am getting the error:

JavaScript

Why does the provided year as a key element does not match the schema? How to avoid this error and make it work?

Below is the screenshot showing the table keys:

enter image description here

Advertisement

Answer

BatchGetItem : From the Docs

The BatchGetItem operation returns the attributes of one or more items from one or more tables. You identify requested items by primary key.

We must specify entire primary key i.e combination of partition key and sort key. Same with GetItem too.

Batch Get:

JavaScript

To get by records only by Partition Key, we can use query.

Query:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement