schema

module of dascore.io.index source

Logical schema for the spool index.

Each stored table is declared once, as a NamedTuple naming its columns in order. The column types are the four primitive storage types (int64, float64, str, bool), written as the python type each surfaces as and marked with None where the column is nullable; times and durations are always epoch/plain nanoseconds stored as int64, never engine-native timestamp types.

The row classes are the single source of truth: TABLES (the logical column types the DDL is built from) is derived from them, and index code reads rows through them with iter_rows(df, Row) (see dascore.utils.pd), which names — for readers and type checkers, not at runtime — the row shape pandas builds dynamically in itertuples. The classes are never instantiated. A frame holding only some of a table’s columns still uses its table’s row class; only the columns actually fetched can be read, and nullable ones may arrive as NaN rather than None (reading code guards with pd.isnull).

The bottom of the module holds the other half of that translation: the SQLite spellings the logical types become, and the DDL built from them. It lives here because both the query builder and the backend need it and this module imports nothing which could import them back.

Functions

Name Description
add_column_sql Return DDL to add one nullable column.
create_table_sql Return DDL for one table from logical column types.
glob_expr Return a parametrized unix-glob match expression.
quote Quote an identifier.

Classes

Name Description
AttrMetaRow A row of the attr_meta table (one indexed attr name and kind).
AttrsRow The fixed part of an attrs row.
CoordDefRow A row of the coord_defs table.
MetaDataRow A row of the meta_data table (the index’s identity and version).
PatchCoordRow A row of the patch_coords table.
PatchRow A row of the patches table.
SourceRow A row of the sources table (one scan unit).