问题
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