0
votes

As per http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html In dynamodb batchget api request syntax there is a ProjectionExpression . It is applied to all items . Can I specify projectionexpression per item in batch get items. say need attr1,attr2 from item1 and attr3,attr4 from item2.

Can I use batchGet? item1 and item2 have different primary and sortkey.

1

1 Answers

0
votes

RequestItems is a map of table names to get requests. If you are trying to get items from two different tables (which it sounds like you are doing) then you would have two RequestItems map entries. Each RequestItems entry would have a unique ProjectionExpression value.

It would look something like this:

{
   "RequestItems": { 
      "table1" : { 
         "AttributesToGet": [ "string" ],
         "ConsistentRead": boolean,
         "ExpressionAttributeNames": { 
            "string" : "string" 
         },
         "Keys": [ 
            { 
               ...
            }
         ],
         "ProjectionExpression": "string"
      },
      "table2" : { 
         "AttributesToGet": [ "string" ],
         "ConsistentRead": boolean,
         "ExpressionAttributeNames": { 
            "string" : "string" 
         },
         "Keys": [ 
            { 
               ...
            }
         ],
         "ProjectionExpression": "string"
      }
   }
   "ReturnConsumedCapacity": "string"
}