## io.SinkChange


What a sink writes for one state of its node: the change since the


Usage

``` python
io.SinkChange(
    view,
    contract,
    schema,
    change,
)
```


state it wrote last, or the whole table.

The tables are built when first used, so a sink that reads only [inserts](io.SinkChange.md#sverify.io.SinkChange.inserts) and [deletes](io.SinkChange.md#sverify.io.SinkChange.deletes) does not build [table](Node.table.md#sverify.Node.table).


## Attributes


`contract`  
What to record with the write ([Contract](io.Contract.md#sverify.io.Contract)): the node, the plan, the source versions and what the node proved about every row. `contract.epoch` grows with every state; a sink that stores it can tell the state it holds ([Sink.contract](io.Sink.md#sverify.io.Sink.contract)).

`schema`  
The table's schema: the node's columns, NOT NULL where the node proves it.

`replace`  
True if the sink's contents must be replaced by [table](Node.table.md#sverify.Node.table): the first write, contents this process did not write, or contents another plan wrote. Then [inserts](io.SinkChange.md#sverify.io.SinkChange.inserts) is [table](Node.table.md#sverify.Node.table) and [deletes](io.SinkChange.md#sverify.io.SinkChange.deletes) is empty.


## Attributes

| Name | Description |
|----|----|
| [change](#change) | The weighted change from the state written last to this one |
| [deletes](#deletes) | The rows to remove, one copy each (with [replace](sql.Dialect.md#sverify.sql.Dialect.replace), none). |
| [inserts](#inserts) | The rows to add (with [replace](sql.Dialect.md#sverify.sql.Dialect.replace), every row). |
| [native](#native) | The state and the change as tables DuckDB holds, when the view |
| [table](#table) | The node's whole state. |

------------------------------------------------------------------------


#### change


The weighted change from the state written last to this one


`change: pa.Table`


(`sverify._weighted`): the copies each row gains or loses, as the view's changes since then add up.


------------------------------------------------------------------------


#### deletes


The rows to remove, one copy each (with [replace](sql.Dialect.md#sverify.sql.Dialect.replace), none).


`deletes: pa.Table`


------------------------------------------------------------------------


#### inserts


The rows to add (with [replace](sql.Dialect.md#sverify.sql.Dialect.replace), every row).


`inserts: pa.Table`


------------------------------------------------------------------------


#### native


The state and the change as tables DuckDB holds, when the view


`native: tuple[Resident, Resident] | None`


keeps its state in DuckDB (`sverify._state.DuckDBStore`): the new state's rows (a DuckDB view), and the weighted change since the state written last (with [replace](sql.Dialect.md#sverify.sql.Dialect.replace), the whole state), computed by the view's merge plan in DuckDB. None otherwise: write the Arrow tables.


------------------------------------------------------------------------


#### table


The node's whole state.


`table: pa.Table`
