Skip to main content

io.from_frame()

A source that reads the whole table on every refresh: fn() returns

Usage

Source

io.from_frame(
    fn,
    *,
    name,
    schema=None,
)

it. Each read is diffed against the last, so the nodes reading it get the exact change and nothing is assumed; a read that changes nothing is no new version.

Parameters

fn: Callable[[], Any]

Returns the table (an Arrow table, a Polars or pandas DataFrame, …), or None if it is not there.

name: str

The table’s name in the plans that read it.

schema: pa.Schema | None = None
The table’s schema, if fn() may return None. Default: that of the first read.

Returns

Source
The source.

Examples

import pyarrow as pa
from sverify.io import from_frame

regions = from_frame(
    lambda: pa.table({"customer": ["ada"], "region": ["eu"]}), name="regions"
)