Amazon AWS SDK Guide d'installation Page 83

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 151
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 82
'KeySchema' => array(
array('AttributeName' => 'CustomerId', 'KeyType' => 'HASH'),
array('AttributeName' => 'OrderId', 'KeyType' => 'RANGE'),
),
'LocalSecondaryIndexes' => array(
array(
'IndexName' => 'OrderDateIndex',
'KeySchema' => array(
array('AttributeName' => 'CustomerId', 'KeyType' => 'HASH'),
array('AttributeName' => 'OrderDate', 'KeyType' => 'RANGE'),
),
'Projection' => array(
'ProjectionType' => 'KEYS_ONLY',
),
),
),
'ProvisionedThroughput' => array(
'ReadCapacityUnits' => 10,
'WriteCapacityUnits' => 20
)
));
$client->waitUntilTableExists(array('TableName' => 'Orders'));
Next you must add some items to the table that you will be querying. There's nothing in the BatchWriteItem
operation that is specific to the LSI features, but since there is not an example of this operation elsewhere in the
guide, this seems like a good place to show how to use this operation.
$result = $client->batchWriteItem(array(
'RequestItems' => array(
'Orders' => array(
array(
'PutRequest' => array(
'Item' => array(
'CustomerId' => array('N' => 1041),
'OrderId' => array('N' => 6),
'OrderDate' => array('N' => strtotime('-5 days')),
'ItemId' => array('N' => 25336)
)
)
),
array(
'PutRequest' => array(
'Item' => array(
'CustomerId' => array('N' => 941),
'OrderId' => array('N' => 8),
'OrderDate' => array('N' => strtotime('-3 days')),
'ItemId' => array('N' => 15596)
)
)
),
array(
'PutRequest' => array(
'Item' => array(
'CustomerId' => array('N' => 941),
'OrderId' => array('N' => 2),
'OrderDate' => array('N' => strtotime('-12 days')),
'ItemId' => array('N' => 38449)
)
)
),
Amazon DynamoDB
71
Vue de la page 82
1 2 ... 78 79 80 81 82 83 84 85 86 87 88 ... 150 151

Commentaires sur ces manuels

Pas de commentaire