Data#

Data sources and the col filter language. A data source owns a set of records and serves them a page at a time, so a data-bound widget works the same whether the records live in memory, a SQLite database, or a file on disk.

For a task-oriented introduction — when to reach for each source, the data bag, observing changes, exporting — see the Data Sources guide.

Data sources#

The concrete sources, the file-source config object, and the base class and protocol for writing your own.

MemoryDataSource

In-memory data manager with pagination, filtering, sorting, and CRUD operations.

SqliteDataSource

SQLite-backed data manager with pagination, filtering, sorting, and CRUD operations.

FileDataSource

A SqliteDataSource whose data is streamed in from a file.

FileSourceConfig

Configuration for file parsing and the per-record transformation pipeline.

BaseDataSource

Abstract base class for datasource implementations.

DataSourceProtocol

Protocol defining the interface for data source implementations.

Query language#

The col expression API for building filter conditions and sort keys, free of SQL. Call these to construct a query, then pass conditions to a source’s where() and sort keys to order().

col

Reference a column by name for use in where() / order().

any_of

Combine conditions with OR.

all_of

Combine conditions with AND.

Query expression types#

The objects the query API produces and that where() / order() accept — handy for type annotations. You rarely construct these directly; build them from col and the comparison operators.

Column

A reference to a column.

Condition

A filter expression.

SortKey

A single sort term: a column and a direction.

Readers and writers#

The pluggable format registries behind FileDataSource and a source’s save(). Register a reader or writer to teach the framework a new file format.

read_records

Stream records from a file, choosing the reader by format or extension.

write_records

Write records to a file, choosing the writer by format or extension.

get_reader

Resolve the reader for a path or extension.

get_writer

Resolve the writer for a path or extension.

register_reader

Register a reader for one or more file extensions.

register_writer

Register a writer for one or more file extensions (decorator or direct).

supported_read_extensions

Return the sorted list of registered readable file extensions.

supported_write_extensions

Return the sorted list of registered writer extensions.

Type aliases#

The record and cell types shared across the module.

type bootstack.data.Primitive#

A single scalar cell value — str | int | float | bool | None.

type bootstack.data.Record#

One data row, keyed by field name — dict[str, Any].