I am using batchGetItem method to retrieve x of items and using ProjectionExpression to retrieve x attributes of each item.
$result = $client->batchGetItem(array(
'RequestItems' => array(
$table => array(
'Keys' => $keys,
'ConsistentRead' => true,
'ProjectionExpression' => "id, name"
),
),
));
$read_items = $result->getPath("Responses/{$table}");
However some of my items have attributes such as name and token which are reserved words in DynamoDB.
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
{"__type":"com.amazon.coral.validate#ValidationException","message":"Invalid ProjectionExpression: Attribute name is a r (truncated...)
ValidationException (client): Invalid ProjectionExpression: Attribute name is a reserved keyword; reserved keyword: name - {"__type":"com.amazon.coral.validate#ValidationException","message":"Invalid ProjectionExpression: Attribute name is a reserved keyword; reserved keyword: name"}
Filename: /var/app/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php
As far I understand expression attribute name is the soultion for this, but I am struggling to find the way to do it batchGetItem, can someone please give a small example how to do it using SDK PHP version 3.20.11 ?