Hi,

what is the best way to create a Table with nested array columns?

I have a 1:N relationship in a data structure and would like to store the 
dependent data in the same row, because at each lookup of a child row I also 
need the parent data and vice versa.

Best would be, if I could create something like this:

class Child(IsDescription):
    id = IntCol()
    valueY = StringCol(10)

class Parent(IsDescription):
    id = IntCol()
    valueX = StringCol(50)
    childList = TableCol(Child)


and the usage would be:

h5 = tables.createFile(..., 'parent_tbl',....., Parent,....)
h5.root.parent_tbl.append(
    [(1,'valuexxx1', [(1, 'y1'), (2,'y2'), (3,'y3')]),
     (2,'valuexxx2', [(1, 'yy12'), (2,'yy22')]),
     (3,'valuexxx3', [(1, 'yyy123')])
    ])

As you can see the Sub-Array has not a fixed length.

If this is not possible what is the best and fastest way to get such a 
structure accessed?

Thanks in advance
Erik



      __________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to