Specifications#
Specs are the write-side schema: validated (pydantic) descriptions of a
table and its columns, consumed by Table.create
and Table.add_column. Their fields are
introduced, with examples, in the
column datatypes and
list columns chapters.
- class h5col.TableSpec(*, columns: list[~h5col.specs.ColumnSpec | ~h5col.specs.ListColumnSpec], title: str | None = None, description: str | None = None, index_columns: list[str] = <factory>, column_order: list[str] | None = None, units_vocabulary: str | None = None, encoding_type: str | None = None, encoding_version: str | None = None)[source]#
Specification of a whole table: its columns and table-level attributes.
- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property ordered_names: list[str]#
Column names in their logical order (column_order, else spec order).
- column(name: str) ColumnSpec | ListColumnSpec[source]#
Return the column spec named name.
- Raises:
KeyError – If no column with that name is defined.
- class h5col.ColumnSpec(*, name: str, dtype: Any = None, chunks: int | tuple[int, ...] | None = None, filters: FilterPipeline | None = None, fill_value: Any = None, valid_min: Any = None, valid_max: Any = None, units: str | None = None, units_vocabulary: str | None = None, description: str | None = None, categories: list[Any] | None = None, ordered: bool | None = None)[source]#
Specification of one column dataset.
dtypeaccepts a NumPy dtype-like, aFixedString, or the boolean dtype frombool_dtype(). For a categorical column, setcategories(the label values);dtypeis then the integer code type and may be omitted (a fitting signed int is chosen).- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class h5col.ListColumnSpec(*, name: str, values: LeafValuesSpec | StringValuesSpec | NestedListSpec, nullable: bool = False, chunks: int | None = None, filters: FilterPipeline | None = None, units: str | None = None, units_vocabulary: str | None = None, description: str | None = None)[source]#
Specification of a list column (a
CLASS=LIST_COLUMNgroup).valuesdescribes theVALUESmember.nullable=Trueadds the top-levelMASKdistinguishing a null list from an empty list per row.chunks/filtersapply to the top-levelOFFSETSdataset.- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class h5col.LeafValuesSpec(*, dtype: Any, chunks: int | None = None, filters: FilterPipeline | None = None, fill_value: Any = None, valid_min: Any = None, valid_max: Any = None, units: str | None = None, units_vocabulary: str | None = None, description: str | None = None)[source]#
A leaf
VALUESmember of a list column: a rank-1 element dataset.The element
dtypemay be any datatype permitted for a column dataset except a variable-length datatype (H5Col forbids those below a list column). Missing elements are expressed with the fill value, exactly as for column datasets; boolean leaves declare no fill (a boolean cannot be missing).- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class h5col.StringValuesSpec(*, nullable: bool = False, chunks: int | None = None, filters: FilterPipeline | None = None)[source]#
A
STRING_VALUESmember: variable-length UTF-8 viaOFFSETS+CHARS.Set
nullable=Trueto add aMASKthat distinguishes a null string element from an empty one.filtersapplies to theCHARSbyte buffer;chunkssets the chunk size of both the group’sOFFSETSdataset andCHARS.- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class h5col.NestedListSpec(*, values: LeafValuesSpec | StringValuesSpec | NestedListSpec, nullable: bool = False, chunks: int | None = None, filters: FilterPipeline | None = None)[source]#
A nested
LIST_COLUMNlevel: itsVALUESmember plus this level’s mask.valuesis the member stored under this level (leaf, string values, or a deeper list).nullable=Trueadds aMASKmarking null inner lists at this level. Used recursively for lists of lists.- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].