Therefore, we will batch 25 movies in each call until we upload the whole list. This is because a single call to BatchWriteItem can have as many as 25 put or delete requests, and each item can be as large as 400 KB. We then iterate again over this big array of items and slice 25 items for each batch request. DocumentClient () const params = const listOfMovies = createFakeMovies ( 500 ) uploadBatchMoviesData (listOfMovies) įrom the above example, we first iterate over the array list of all the movies to construct the shape of the PutRequest body. This example uses the DynamoDB documentClient get method. Basically, you can use Javascript objects directly and pass them to DynamoDB methods, and the Document Client will map the Javascript types to the DynamoDB tables.įor example, to get an item from a DynamoDb table, this example below will show the differences in constructing the param object between the Document Client and the DynamoDb direct method. Document ClientĭynamoDb Document Client simplifies working with the DynamoDB methods by abstracting away the notion of attribute values. For the PartiQL specification and a tutorial on the core query language, see the PartiQL documentation. PartiQL operations provide the same availability, latency, and performance as the other DynamoDB data operations. Quick introduction to the Document Client and PartiQL PartiQLĪmazon DynamoDB supports PartiQL, an SQL-compatible query language to select, insert, update, and delete data in DynamoDB.
I will be using the AWS Javascript SDK throughout my Node.js code examples. I will also be touching on the performance and features of using either approach. In this article, I would like to compare querying and inserting data into dynamoDb using PartiQL vs. When this was launched, I was initially excited because it means I can write my queries in a more familiar way of SQL-like queries rather than using the Document Client API. AWS recently announced a new feature to give users the ability to use PartiQL, which is an SQL compatible query language to work with data in Amazon DynamoDB.