gavo.grammars.directhdf5 module

Helpers for generating boosters for HDF5 data.

HDF5 is fairly complex, and directgrammar is too long as is. Also, I don’t want to require h5py as a fixed dependency of DaCHS; if it’s not there, you should still be able to use other sorts of direct grammars.

TODO: Most of the hdf interface functions return 0 on success, != on failure; we’d like a macro to catch these.

class gavo.grammars.directhdf5.HDF5vaexCodeGenerator(grammar, tableDef)[source]

Bases: gavo.grammars.directgrammar._NumpyMetaCodeGenerator

A code generator for boosters importing HDF5 files in VAEX convention.

These have one array per column in a “columns” group; the actual data is in a “data” group.

Our strategy when parsing from them is to read CHUNK_SIZE items at a time into the corresponding arrays, and then iterating over these chunks, building the records.

getFooter()[source]

returns the code for the createDumpfile method.

You want to use the C fragments above for that.

The default returns something that bombs out.

getItemParser(item, index)[source]

returns code that parses item (a Column instance) at column index index.

You’re free to ignore index.

getPreamble()[source]

returns a list of lines that make up the top of the booster.

getPrototype()[source]

returns the prototype of the getTuple function.