io.Contract
What a sink records with each commit: which plan produced the data,
Usage
io.Contract(
view,
plan,
sources,
epoch,
not_null,
checks,
unique,
digests=dict(),
cursors=dict(),
table_ids=dict(),
format=CONTRACT_FORMAT
)from which source versions, and what it proved about every row.
DeltaSource.contract() and IcebergSource.contract() read it back.
Attributes
view: str-
The stored node’s name.
sources: dict[str, int]-
The version of every source table the state was computed from.
not_null: list[str]-
Columns the node proves NOT NULL: stated in
ensures(_.col.notnull()), or shown never NULL by its proved report (Report.not_null). unique: list[list[str]]-
Column sets the node proves unique.
cursors: dict[str, Any]-
The cursor of every source that can restore its table from one (Source.restore), at its version in
sources. table_ids: dict[str, str]-
The id of every source table that has one (a Delta table’s
metaData.id), at its version insources.
Methods
| Name | Description |
|---|---|
| from_json() | A contract from what to_json wrote, by this version of sverify |
| to_json() | The contract as JSON, as sinks store it. |
from_json()
A contract from what to_json wrote, by this version of sverify
Usage
from_json(text)or an earlier one. Keys this version does not know, which a later 1.x version may add, are left out.
Parameters
text: str- The JSON to_json wrote.
Returns
Contract- The contract.
Raises
ValueError- The record’s format is newer than this version reads.
to_json()
The contract as JSON, as sinks store it.
Usage
to_json()Returns
str-
A JSON object with the contract’s fields, keys sorted, in the
format ofsverify/schemas/sink-contract.schema.json.