Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QueryFilter not working in DynamoDB

I'm trying to query all queued notifications of my table 'notifications' table in DynamoDB.

Global Secondary Indexes: Name: idTo-time-index
Hash Key: idTo (Number)
Range Key: time (Number)

Why I'm getting all results and not only the ones with status=='queued'?

$params = array(
    'TableName' => 'notifications',
    'IndexName' => 'idTo-time-index',
    'KeyConditions' => array(
        "idTo" => array(
            "AttributeValueList" => array(
                array('N' => 1)
            ),
            "ComparisonOperator" => "EQ"
        )
    ),
    'ScanIndexForward' => false,
    'QueryFilter' => array(
        "status" => array(
            "AttributeValueList" => array(
                array('S' => (string)"queued")
            ),
            "ComparisonOperator" => "EQ"
        )
    ),
);

$response = $dynoClient->query($params);
like image 325
Rafael D'Arrigo Avatar asked Feb 02 '26 05:02

Rafael D'Arrigo


1 Answers

I had the same problem, I solve that problem by updating the ASW SDK, the reason is that query filter was added recently, in my old SDK when i execute the same query then Query filter was not working.

Updating the SDK should solve your problem

Hope that helps

like image 55
Harshal Bulsara Avatar answered Feb 04 '26 18:02

Harshal Bulsara