我可以查询 Windows Azure Tablestorage 行中的任何属性吗?
抱歉,如果这听起来像是一个相当愚蠢的问题,但我想对 Windows Azure 表中的数据进行“选择”。我尝试了以下方法,它起作用了:
from question in _statusTable.GetAll()
where status.RowKey.StartsWith(name)
然后我尝试了
from question in _statusTable.GetAll()
where status.Description.StartsWith(name)
这个,但它没有给我带来任何好处。任何人都可以向我解释是否或如何查询不属于 RowKey 或 PartitionKey 的行。
Sorry if this sounds like a rather dumb question but I would like to do a "select" on data from a Windows Azure table. I tried the following and it worked:
from question in _statusTable.GetAll()
where status.RowKey.StartsWith(name)
I then tried
from question in _statusTable.GetAll()
where status.Description.StartsWith(name)
This one gave me nothing. Can anyone explain to me if or how I can query on rows that are not part of the RowKey or PartitionKey.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以查询任何属性,但支持的查询类型有限 - 例如不支持
StartsWith
。此外,如果您不查询 PartitionKey 和 RowKey,那么还有一些非常重要的性能问题需要了解 - 并且您始终需要注意 ContinuationToken - 几乎任何查询结果都可以包含这些问题。您可以通过查看 REST API 来了解支持的查询类型: http:// msdn.microsoft.com/en-us/library/dd894031.aspx - 它非常有限(但结果很快):
如果您需要做更多,那么:
GreaterThanOrEqualTo("Fred") 和 LessThan("Free")
来模仿StartsWith("Fred")
之类的事情code>You can query on any property, but the types of query supported are limited - e.g.
StartsWith
isn't supported. Also if you aren't querying on PartitionKey and RowKey, then there are some very important performance issues to understand - and you always need to be aware of ContinuationToken's - almost any query result can contain these.You can see the sorts of queries supported by looking at the REST API: http://msdn.microsoft.com/en-us/library/dd894031.aspx - it's pretty limited (but quick as a result):
If you need to do more, then:
StartsWith("Fred")
by doing aGreaterThanOrEqualTo("Fred") and LessThan("Free")
GetAll() 的作用是什么? WA 表不支持 StartsWith,因此我假设 GetAll 将所有数据提取到本地,因此您的查询是在内存中的对象上完成的。如果是这样,这与 Windows Azure 无关,所以我会看看您的数据是否像您期望的那样。
What does GetAll() do? StartsWith isn't supported by WA tables, so I'm assuming GetAll pulls all the data local, and so your query is done over objects in memory. If so, this has nothing to do with Windows Azure, so I'd take a look at whether your data looks like you expect it to.