How do I make a query in Codeigniter 3 with dynamodb and in addition include an index?
In my example I get the following error:
1 validation error detected: Value null at 'hashKeyValue' failed to satisfy constraint: Member must not be null
This is my example :
function obtener($fecha_registro) {
$client = new AmazonDynamoDB();
$response = $client->query( array(
'TableName' => 'nom_table',
'KeyConditionExpression' => 'id_registro = :v_hash and fecha_registro = :v_range',
'ExpressionAttributeValues' => array (
':v_hash' => array('S' => '148537355319'),
':v_range' => array('S' => $fecha_registro)
)
));
print_r($response);
if ($response->status == '200'){
return $response->body->Items;
} else {
print_r($response);
}
}
The Only Reason you are getting this Error is :
As per DynamoDB Documentation :
The Same issue is Raised at AWS Developer Forum also.
Solution :
Before passing your variable
$fecha_registroto functionobtener(), You need to check whether the passed variable isNon EmptyorNot NullFor your scenario just add a check before calling your function as below :