Skip to main content

types.CompressedArrayTypeDecorator

Stores a NumPy array as zlib-compressed binary data in the DB.

Usage

Source

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

Source

__init__(dtype=np.float64, *args, **kwargs)

process_bind_param()

Convert a NumPy array to zlib-compressed .npy bytes for the database.

Usage

Source

process_bind_param(value, dialect)

process_result_value()

Convert compressed .npy bytes from the database back to a NumPy array.

Usage

Source

process_result_value(value, dialect)