Introduction
H5pom is an object mapper for keeping a python object hierarchy synchronized with an HDF5 data file. Think of this as an ORM for HDF5 based storage. Under the hood H5pom uses h5py for communicating with the data store, but this dependency is intended to be entirely abstracted away by the the object mapper layer.
The requirements to save and restore objects from an HDF5 data file using H5pom are modest and in keeping with the usual requirements for using another ORM like Sqlalchemy and Django. The only needs are to derive your domain specific classes from h5pom.Object and declare your attributes as class attributes. Here is an example usage:
>>> import h5pom >>> class Person(h5pom.Object): ... name = h5pom.Scalar() ... age = h5pom.Scalar() ... >>> f = h5pom.open(h5pom.IN_MEMORY, [Person]) >>> p = Person(name='Joe', age=25) >>> f['joe'] = p >>> assert f['joe'].name == 'Joe' >>> p.age = 23 >>> assert f['joe'].age == 23 >>> f.close()
In that example, there is no file made on disk due to the use of h5pom.IN_MEMORY used as the file name, but the code is representative and complete for the simple notion of saving Person objects to an HDF5 file.
Goals of H5pom
H5pom aims to make it easy to store and synchronize python object graphs which may or may not have numeric array data in an HDF5 file. For array types of known numpy dtype H5pom aims to expose the full performance of HDF5 and h5py as appropriate.
H5pom does not aim to have the full generality of reading arbitrary HDF5 files. The h5py project already has an excellent pythonic API for accessing groups, subgroups and attributes. H5pom will tend to emphasize a schema where the schema is a list of class types which may appear in the HDF5 file and the attributes on those objects are known at the point of writing the python model implementation.
Object Mapping Basics
H5pom heavily utilizes the group and attribute notions in HDF5. The following general correspondences illustrate the design:
python objects <-> groups
scalar attributes of python objects <-> group attributes
object references of python objects <-> subgroup with-in parent object group
array type as attribute of python object <-> dataset with-in parent object group
python list as attribute of python object <-> family of attributes with prefixed names with-in parent object group
TODO
SubObjectDict saves dictionaries mapping alphanumeric names to Objects, but there is no persistent dictionaries mapping alphanumeric names to Scalars. Consider adding this.
Metadata
Release files for h5pom 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| h5pom-0.1.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| h5pom-0.1-py2.7.egg | Legacy Egg format | - | - | Details |
Total release size: 30.3 kB
Release files / h5pom-0.1.tar.gz
| Download URL | h5pom-0.1.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
977f53c911e9f73317eea5ede519b4d588cf3aefd7a616cbb719b75f2e1d354c
|
|
BLAKE2b-256 checksum How to use checksums |
a95fd6d66dd4ead91ea0a535a83eaba7b0da8b7662765c3261af9789e952ada4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / h5pom-0.1-py2.7.egg
| Download URL | h5pom-0.1-py2.7.egg |
|---|---|
| Size | 20.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
8b6056f8cbd2b9a50910d039ab90c7f061e9a3959d2c41892c02671c1a839855
|
|
BLAKE2b-256 checksum How to use checksums |
9e9add7928378546ae8f379291a10d0fade93961a01640ed93b6254e1945854c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |