Create Directory Hierarchy Structure in Azure Tables Storage

喜你入骨 提交于 2019-12-07 12:05:20

问题


Is it possible to create a directory like structure in Azure Tables?

I need to store some metadata in a tree like structure.

For example if I have 10 items and each item contains some metadata columns (there are some common columns for all of them [id, name, date created, author ... ], but might be also some columns that one item might have but another one no)

Can these items be stored in a structural way?

      Item1
        |_____ Item2
                 |_____ Item3
                          |_____ ItemX

回答1:


You can't nest the way you describe, but using Azure Tables, you don't necessarily need to. In the example above, I would set Item1 = Partition Key. Items 2-->n would each be a Row Key. Each Row can have a unique schema & each item would be part of the index so lookup would be very fast.

Row Keys only need to be unique within the partition, so you could have a repeating pattern if required (hard to tell from the desc.).

You could then get all items related to Item1 by querying against the PK, or get an individual item by specifying PK + RK.




回答2:


no - Azure tables are not relational - read more here. You can however have multiple properties so that entities have properties that aren't populated. If you have an Azure account, you can use the Azure Storage Explorer to explore and test Azure tables.



来源:https://stackoverflow.com/questions/14611574/create-directory-hierarchy-structure-in-azure-tables-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!