how to retrive more than 1000 rows in azure tables php -
i trying more 1000 rows azure in php. first of not able use filter class. namespace need added use filter class after while loop gng in infinite loop help
$tablerestproxy = servicesbuilder::getinstance()->createtableservice($this->connectionstring); $filter = "( partitionkey eq '$id' )";
$options = new queryentitiesoptions(); $options->setfilter(filter::applyquerystring($filter)); $result = $tablerestproxy->queryentities('test', $options); $entities = $result->getentities(); $nextpartitionkey = $result->getnextpartitionkey(); $nextrowkey = $result->getnextrowkey(); while (!is_null($nextrowkey) && !is_null($nextpartitionkey) ) { $options = new queryentitiesoptions(); $options->setnextpartitionkey($nextpartitionkey); $options->setnextrowkey($nextrowkey); $options->setfilter(filter::applyquerystring($filter)); $result2 = $tablerestproxy->queryentities("test", $options); $newentities = $result2->getentities(); $entities=array_merge($newentities, $entities); }
link m using php - azure table storage in more 1000 entities
you can leverage settop()
function of microsoftazure\storage\table\models\queryentitiesoptions
class select top x (number) entities of table.
and according description @ https://github.com/azure/azure-storage-php/blob/master/src/table/models/queryentitiesoptions.php#l148, can find filter classes have moved namespace microsoftazure\storage\table\models\filters
if want use filter classes in new azure storage sdk php, can try include package as:
use microsoftazure\storage\table\models\filters\querystringfilter;
please consider following code snippet:
use microsoftazure\storage\table\models\queryentitiesoptions; use microsoftazure\storage\table\models\filters\querystringfilter; $options = new queryentitiesoptions(); $filter = new querystringfilter("(rowkey eq '".$id."')"); $options->setfilter($filter); $options->settop(1000);
Comments
Post a Comment