Azure 表复杂数据最佳实践

发布于 2024-10-25 05:30:15 字数 309 浏览 2 评论 0原文

我正在开展一个研究项目,需要将复杂数据作为实体存储在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

哑剧 2024-11-01 05:30:15

在这种情况下,我认为 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).

囚我心虐我身 2024-11-01 05:30:15

我认为在使用 Azure 进行此类存储时需要考虑很多事情 - 特别是考虑:

  • 索引 - Azure 只允许您仅在元组 (帐户、表名、分区键、行键)上建立索引和排序 - 因此,如果您需要以多种方式搜索或排序数据,那么通常您需要考虑将多个实体添加到多个表中以表示单个实际实体
  • 聚合 - Azure 表存储不包含任何类似 SQL 的内容SUM、AVERAGE 等函数 - 因此,如果您需要执行其中任何操作,那么您需要在自己的代码中执行它们,并将结果保存在某处(或每次都动态生成它们 - 但这可能会很慢并且对于大型数据集来说成本高昂)
  • 性能 - 根据您的应用程序,这里可能需要考虑很多因素。
  • 成本 - 请记住,Azure 存储按事务收费 - 因此,如果您执行大量查询,那么可能会花费您金钱(另请记住,虽然 Azure 存储是可扩展的,但每个帐户的每秒查询限制并不那么高)

有很多关于使用 Azure 表和 Blob 存储的模式和实践的文章和文档 - 对于您的情况,将 Blob 与一个或多个基于表的索引一起使用听起来确实是一种值得探索的途径。

I think there's a lot to think about when using Azure for this type of storage - especially thinking about:

  • indexing - Azure only allows you to index and order only on the tuple (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 entity
  • aggregation - Azure table storage doesn't contain any SQL-like SUM, AVERAGE, etc functions - so if you need to do any of these then you'll need to do them in your own code and to persist the result somewhere (or generate them on the fly each time - but this could be slow and costly for large data sets)
  • performance - depending on your application, there may be lots to consider here.
  • cost - remember that Azure storage charges per transaction - so if you do a lot of queries then it can cost you money (also remember that while Azure storage is scalable, the per second query limits per account aren't that high)

There 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.

少女情怀诗 2024-11-01 05:30:15

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文