从 Azure 表中获取所有实体时,我们是否能够筛选分区键


Are we able to filter Partition Key when getting all entities from Azure Tables?

正如标题中所述,我想知道从 Azure 表中获取所有实体时是否可以过滤分区键?

我尝试将其添加到过滤器中,但它不起作用:

$filter = "PartitionKey eq '" . $fields['authorId'] . "'";
$tableRest_result = $this->tableRestProxy->queryEntities($this->_tables['THEME']['SETTINGS'], $filters);
$entities = $tableRest_result->getEntities();

我正在使用PHP访问Azure表。

非常感谢您的帮助。谢谢!

我认为这样做

是可能的。表服务 REST API 支持query projection,您可以在其中从表中为每个实体提取属性子集 (http://blogs.msdn.com/b/windowsazurestorage/archive/2011/09/15/windows-azure-tables-introducing-upsert-and-query-projection.aspx)。

我简要地查看了 Github for PHP SDK (https://github.com/WindowsAzure/azure-sdk-for-php/blob/master/WindowsAzure/Table/Models/QueryEntitiesOptions.php) 上的代码,我认为您应该能够使用addSelectField()方法指定您希望查询返回的字段。如果我没记错的话,这是QueryEntitiesOption的一部分,您可以将其指定为queryEntities函数 (https://github.com/WindowsAzure/azure-sdk-for-php/blob/master/WindowsAzure/Table/TableRestProxy.php) 的参数。我不使用 PHP,所以我自己没有尝试过。试一试,看看是否有效。

希望这有帮助。

相关文章: