Azure Table Storage: Storing Relationships -


when storing 1 many relationship in azure table storage (such storing id of owner of record) store both partitionkey , rowkey 2 separate fields? or somehow concatenate 2 fields 1 field purpose of simpler storage?


edit - more clarity on i'm asking

i know table storage not relational. , i'm not looking foreign key integrity or cascading deletes or that.

but without being "relational" there still common need store pointer record in table. has thousands of uses. example of storing user created record 1 example. storing sort of list or array example (such list of "work experience" records in resume, or list of contact addresses person record.)

because "primary key" of azure table storage table 2 fields, i'm wondering if there common convention on how store information. "best practice?"

the options see are:

  • concatenate partitionkey , rowkey 1 field , store "foreign key" (i know there no real foreign keys).
  • store both fields separately , use foreign key.
  • a third option haven't though tof.

is there "best practice" here? there reason choose 1 method on another?

first thing azure table storage not relational database natively supports one-to-many relationships. anyways can develop scenario mentioned. key point partitionkey + rowkey must unique in table. in given partition (represented partitionkey), cannot duplicate rowkey.

so guess concatenation right way. otherwise if use partitionkey , rowkey main table partitionkey , rowkey in second table won't able have one-to-many relationship. because one record in main table have many records in second table , these records in second table cannot have same partitionkey , rowkey values.

please note concatenating partitionkey , rowkey result in separate partitions in second table every record in main table. , if have scenario want query multiple partitions in second table, slow.

the important point when designing structure of tables storage main consideration data access pattern. should see how access data , design structure accordingly.

hope helps.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -