RowKeys上的Azure表存储范围查询通过REST API返回错误的请求

时间:2016-02-15 15:24:47

标签: azure azure-table-storage

在对Azure Table Storage api的ajax请求中,我指定了以下url

url:'https://myaccount.table.core.windows.net/mytable(PartitionKey=\'2016-01-12_1\')?$filter=RowKey+ge+1',

哪个请求响应错误。我尝试了一些修改,例如在过滤器中的单词之间使用普通空格或使用%20,但结果是相同的。

我确定该分区存在且包含大于1的值。

如果网址格式为:

url:'https://myaccount.table.core.windows.net/mytable(PartitionKey=\'2016-01-12_1\',RowKey=\'someValue\'),

然后它的工作原理。但我无法使用过滤器。什么想法可能会出错?

1 个答案:

答案 0 :(得分:3)

我相信你不正确地使用它。如果您在括号中指定PartitionKey,那么您也必须在其中使用RowKey。你不能混合2个选项。

来自Querying Tables and Entities

  

因为PartitionKey和RowKey属性构成了一个实体   主键,您可以使用特殊语法来标识实体,如   如下:

https://myaccount.table.core.windows.net/Customers(PartitionKey='MyPartition',RowKey='MyRowKey1')

如果您要在RowKey上过滤某些PartitionKey值,则必须仅在PartitionKey中指定$filter。因此,您的请求网址为:

https://myaccount.table.core.windows.net/mytable()?$filter=PartitionKey eq 'PartitionKeyValue' and RowKey ge 'RowKeyValue'
相关问题