types.CompressedArrayTypeDecorator
Stores a NumPy array as zlib-compressed binary data in the DB.
Usage
types.CompressedArrayTypeDecorator(
dtype=np.float64,
*args,
**kwargs,
)Shape and dtype are preserved via the NumPy .npy format, so this works for arrays of any dimensionality (flat vectors, coordinate matrices, Hessians, …).
Methods
| Name | Description |
|---|---|
| __init__() |
Create the decorator, storing arrays as dtype (or as given if None).
|
| process_bind_param() |
Convert a NumPy array to zlib-compressed .npy bytes for the database.
|
| process_result_value() |
Convert compressed .npy bytes from the database back to a NumPy array.
|
__init__()
Create the decorator, storing arrays as dtype (or as given if None).
Usage
__init__(dtype=np.float64, *args, **kwargs)process_bind_param()
Convert a NumPy array to zlib-compressed .npy bytes for the database.
Usage
process_bind_param(value, dialect)process_result_value()
Convert compressed .npy bytes from the database back to a NumPy array.
Usage
process_result_value(value, dialect)