Amazon AWS SDK Przewodnik Instalacji Strona 83

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 151
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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
Przeglądanie stron 82
1 2 ... 78 79 80 81 82 83 84 85 86 87 88 ... 150 151

Komentarze do niniejszej Instrukcji

Brak uwag