From: Francesc A. <fa...@ca...> - 2005-11-04 12:29:34
|
Hi Jeff, A Divendres 04 Novembre 2005 04:15, Jeff Whitaker va escriure: > Is it possible to create tables with entries are themselves tables? (I > read section 3.6 of the tutorial, but couldn't quite figure out if it > does what I want). Specifically, I would > like to have a table like this: > > Observation =3D { > "id": StringCol(length=3D16) > "lat: Float32Col() > "lon": Float32Col() > "value": Float32Col() > "type": StringCol(length=3D4) > "qcflags": <another table whose structure depends on the value of "type"> > } Nope. You cannot do this sort of things. The nested capabilities of PyTables means the you are able to create nested records in the *same* table, not referencing other tables. You can nevertheless add the name of the table as a string column, like this: Observation =3D { "id": StringCol(length=3D16) "lat: Float32Col() "lon": Float32Col() "value": Float32Col() "type": StringCol(length=3D4) "qcflags": StringCol(length=3D256) # put here the name of the other table } and then, retrieve the actual table by issuing a: for row in table: ... othertable=3Dfileh.getNode(row['qcflags']) Cheers, =2D-=20 >0,0< Francesc Altet =A0 =A0 http://www.carabos.com/ V V C=E1rabos Coop. V. =A0=A0Enjoy Data "-" |