Reputation: 5748
Starting from a simple structure like this one:
from tables import *
class subTable(IsDescription):
subCol1= Int64Col(pos=0)
subCol2= StringCol(itemsize=32, pos=1)
subCol3= Int64Col(pos=2)
class mainTable(IsDescription):
column1= Int64Col(pos=0)
column2= StringCol(itemsize=32, pos=1)
column3= subTable()
If I understood the documentation good, now I have a table (mainTable), with 3 columns (column1, column2, column3)
that has another table contained in each column3
, with another 3 columns (subCol1, subCol2, subCol3)
So, now, filling the main table with rows is an easy job.
However....what to do to add rows to each table inside column3
??
Of course, If I am wrong I would appreciate any correction.
Upvotes: 0
Views: 268
Reputation: 4017
What you did is not wrong, it's just that I don't think you can have multiple rows for the subTable
:
from tables import *
class subTable(IsDescription):
subCol1= Int64Col(pos=0)
subCol2= StringCol(itemsize=32, pos=1)
subCol3= Int64Col(pos=2)
class mainTable(IsDescription):
column1= Int64Col(pos=0)
column2= StringCol(itemsize=32, pos=1)
column3= subTable()
hdf5_a = openFile("delete.hdf5", "a")
table = hdf5_a.create_table("/", "test", mainTable)
table.row['column3/subCol1'] = 10
table.append()
So you can put values for subTable
with table.row['column3/subColX']
. But not multiple rows.
Upvotes: 0