Azure 表复杂数据最佳实践
我正在开展一个研究项目,需要将复杂数据作为实体存储在 Azure 表中。表的实体是包含许多几何点和线的单元格,以及对父级的引用等。
除非我弄错了,否则实体只能包含简单类型(string、int、bool 等),但不能像 List 那样包含任何类型。与此同时,我正在解决这个问题,方法是序列化整个结构并将其转换为 base64 字符串,并使实体仅包含该字符串以及一些其他标志。
从长远来看,这是一种可笑的方法,但在部署更负责任/合适的方法之前,这种黑客行为目前必须进行。
对于复杂数据类型和 Azure,最佳实践是什么?写出许多 blob 并用表格跟踪它们?
I'm working on a research project that needs to store complex data as entities in an Azure Table. The entities for the table are cells that contains many geometric points and lines, with references to parents and so on.
Unless I am mistaken, an entity can only contain simple types (string, int, bool, etc) but nothing like List. I'm working around this in the meantime by just serializing the entire structure and converting that to a base64 string and having the entity consist of just this string, as well as some other flags.
Now that is a ludicrous approach in the long run, but that hack will have to do for now until a more responsible/appropriate method is deployed.
What would the best practices be for complex data types and Azure? Write many blobs out and keep track of them with a table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在这种情况下,我认为 Azure 存储与常规数据存储没有太大区别。复杂数据类型总是将其属性映射到简单数据列,或者进行序列化(如您所说)。
I don't think Azure storage differs much from regular data storage in this case. Complex data types always either have their properties mapped to simple data columns, or you serialize (as you said).
我认为在使用 Azure 进行此类存储时需要考虑很多事情 - 特别是考虑:
(帐户、表名、分区键、行键)上建立索引和排序
- 因此,如果您需要以多种方式搜索或排序数据,那么通常您需要考虑将多个实体添加到多个表中以表示单个实际实体有很多关于使用 Azure 表和 Blob 存储的模式和实践的文章和文档 - 对于您的情况,将 Blob 与一个或多个基于表的索引一起使用听起来确实是一种值得探索的途径。
I think there's a lot to think about when using Azure for this type of storage - especially thinking about:
(account, table name, partition key, row key)
- so if you need to search or order your data in multiple ways then generally you need to think about adding multiple entities to multiple tables to represent your single actual entityThere are lots of articles and documents out there on patterns and practices for using Azure table and blob storage - for your situation, using Blobs with one or more table based indicies certainly sounds like one avenue to explore.
lokad 工具包是 Azure 最好的朋友。
您正在寻找“胖实体”http://code.google.com /p/lokad-cloud/wiki/FatEntities
The lokad toolkit is your best friend for azure.
You're looking for a "Fat Entity" http://code.google.com/p/lokad-cloud/wiki/FatEntities