A Monday 12 May 2008, Nick Bower escrigué: > > 2. Has anyone contended with managing schema differences between > > sources? In other words, if I have say 500 loggers, each logging > > slightly different schemas (ie 100 different columns and so > > different table definitions), the suggested Pytables way of binding > > static data definitions for each logger could be unmaintainable. > > From memory I can dynamically bind class attributes in Python - is > > this ok? > > Ok I found the docs on defining tables with dictionaries instead of > classes. Fyi this does not work with PyTables: > > > class LoggerRecord(tables.IsDescription): > pass > > LoggerRecord.col1 = tables.Float32Col() # dynamically bind > > h5file = tables.openFile("test.h5", mode = "w", title = "test") > group = h5file.createGroup('/', 'test', 'Test Data') > table = h5file.createTable(group, 'data', LoggerRecord, 'Data') > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/usr/lib/python2.5/site-packages/tables/file.py", line 736, > in createTable > chunkshape=chunkshape, byteorder=byteorder) > File "/usr/lib/python2.5/site-packages/tables/table.py", line 517, > in __init__ > self.description = Description(descr.columns) > File "/usr/lib/python2.5/site-packages/tables/description.py", line > 480, in __init__ > self._g_setPathNames() > File "/usr/lib/python2.5/site-packages/tables/description.py", line > 547, in _g_setPathNames > head = cols[0] > IndexError: list index out of range
Yes. Using dictionaris is the official way to dinamically define fields on tables. Assigning fields dynamically to a IsDescription subclass is not currently supported. Cheers, -- Francesc Alted ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users