Amazon AWS SDK Installationsanleitung Seite 83

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 151
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 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
Seitenansicht 82
1 2 ... 78 79 80 81 82 83 84 85 86 87 88 ... 150 151

Kommentare zu diesen Handbüchern

Keine Kommentare