2015-06-05 36 views
2

我有一个dynamidb表与uid的散列键和Score的范围键,我想获得一个元素返回。通过所有的在线文档的准备后,不幸的是我能找到我仍然得到同样的错误:通过散列和范围dynamodb查询问题

AWS Error Message: Either the KeyConditions or KeyConditionExpression parameter must be specified in the request.

$result = $this->client->query(array(
    'TableName' => 'Leaderboard', 
    'KeyConditionExpression' => 'uid = :u_id and Score >= :u_score', 
    'ExpressionAttributeValues' => array (
     ':u_id' => array('S' => 'test'), 
     ':u_score' => array('S' => '100') 
    ), 
    'ConsistentRead' => true 
)); 

print_r($result['Items']); 

“KeyConditionExpression”显然包括查询参数内。 我也试过'N'=>'100',这样做更有意义,但是这并没有解决看似无关的错误。

+1

可以检查你的php-sdk的是最新的.. –

+0

谢谢你,似乎解决了以前的问题:) –

回答

0
  • 查询项目

    $response = $client->query(array(
        'TableName' => '[Table_Name]', 
        'KeyConditionExpression' => '[Hash_Name] = :v_hash and [Range_Name] = :v_range', 
        'ExpressionAttributeValues' => array (
         ':v_hash' => array('S' => '[Hash_Value]'), 
         ':v_range' => array('S' => '[Range_Value]') 
        ) 
    )); 
    
    echo $response; 
    


链接帮助

希望这有助于

相关问题