title: Is there a Python API for submitting batch get requests to AWS DynamoDB?
body: <p>The package <code>boto3</code> - Amazon's official AWS API wrapper for python - has great support for uploading items to DynamoDB in bulk.  It looks like this:</p>
  
  <pre><code>db = boto3.resource("dynamodb", region_name = "my_region").Table("my_table")
  
  with db.batch_writer() as batch:
      for item in my_items:
          batch.put_item(Item = item)
  </code></pre>
  
  <p>Here <code>my_items</code> is a list of Python dictionaries each of which must have the table's primary key(s).  The situation isn't perfect - for instance, there is no safety mechanism to prevent you from exceeding your throughput limits - but it's still pretty good.</p>
  
  <p>However, there does not appear to be any counterpart for reading from the database.  The closest I can find is <code>DynamoDB.Client.batch_get_item()</code>, but here the API is extremely complicated.  Here's what requesting two items looks like:</p>
  
  <pre><code>db_client = boto3.client("dynamodb", "my_region")
  
  db_client.batch_get_item(
      RequestItems = {
          "my_table": {
              "Keys": [
                  {"my_primary_key": {"S": "my_key1"}},
                  {"my_primary_key": {"S": "my_key2"}}
              ]
          }
      }
  )
  </code></pre>
  
  <p>This might be tolerable, but the response has the same problem: all values are dictionaries whose keys are data types (<code>"S"</code> for string, <code>"N"</code> for number, <code>"M"</code> for mapping, etc.) and it is more than a little annoying to have to parse everything.  So my questions are:</p>
  
  <blockquote>
    <p>Is there any native <code>boto3</code> support for batch reading from DynamoDb, similar to the <code>batch_writer</code> function above?</p>
  </blockquote>
  
  <p>Failing that,</p>
  
  <blockquote>
    <p>Does <code>boto3</code> provide any built-in way to automatically deserialize the responses to the <code>DynamoDB.Client.batch_get_item()</code> function?</p>
  </blockquote>
  
  <p>I'll also add that the function <code>boto3.resource("dynamodb").Table().get_item()</code> has what I would consider to be the "correct" API, in that no type-parsing is necessary for inputs or outputs.  So it seems that this is some sort of oversight by the developers, and I suppose I'm looking for a workaround.</p>