Amazon AWS SDK Guía de instalación Pagina 83

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 151
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 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
Vista de pagina 82
1 2 ... 78 79 80 81 82 83 84 85 86 87 88 ... 150 151

Comentarios a estos manuales

Sin comentarios