You are working as a Senior Software Developer for a large pharmaceutical company.
Your lead has asked you to work on a new module in which you need to query a DynamoDB table with multiple Partition Key values at once and store the result in CSV format on S3
Which operation will you use to achieve the same?
Click on the arrows to vote for the correct answer
A. B. C. D.Correct Answer: D.
BatchGetItem API allows you to pass multiple Partition Key values in a single request.
Option A is incorrect: Scan API does not query table using Partition or Sort Key in request.
It fetches all records from the table.
Option B is incorrect: Query API does not support querying table using a multiple Partition Key values.
Option C is incorrect: GetItem API only accepts a single Partition or Sort key for querying data.
Unlike Query operation, GetItem API requires passing of both Partition and Sort Key in the request.
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.htmlThe operation that you would use to query a DynamoDB table with multiple Partition Key values at once and store the result in CSV format on S3 is BatchGetItem.
BatchGetItem is a DynamoDB API operation that allows you to retrieve multiple items from one or more tables in a single request. It is designed to be efficient for retrieving items that have a known primary key. In this case, you are querying the table with multiple Partition Key values at once.
To use BatchGetItem, you would specify the table name and a list of keys for each item you want to retrieve. The keys can be either a single Partition Key value or a composite Primary Key value. If any of the requested items are not found, the operation returns only the items that were found.
Once you have retrieved the items using BatchGetItem, you can then convert them to CSV format and store them on S3 using the AWS SDK or a third-party library. The exact implementation would depend on the programming language and framework you are using.
The other options provided in the question are not suitable for this use case: