# build_delta_channels_writes_history

> **Function** in `langgraph.checkpoint.sqlite`

📖 [View in docs](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/_delta/build_delta_channels_writes_history)

Demux stage-2 rows per channel; produce per-channel histories.

Stage-2 rows are `(checkpoint_id, channel, task_id, idx, type, value)`.
Final write order is oldest→newest globally and `(task_id, idx)` within
a checkpoint, matching the contract on `DeltaChannelHistory.writes`.

`seed` is omitted when the walk reached a true root with no snapshot
found (channel never entered `seeded`); consumers treat absence as
"start empty".

## Signature

```python
build_delta_channels_writes_history(
    *,
    channels: Sequence[str],
    chain_by_ch: Mapping[str, list[str]],
    seed_val_by_ch: Mapping[str, Any],
    seeded: set[str],
    stage2_rows: Sequence[tuple[str, str, str, int, str, bytes]],
    serde: Any,
) -> dict[str, DeltaChannelHistory]
```

---

[View source on GitHub](https://github.com/langchain-ai/langgraph/blob/1a9baae9592e0c21336f6e09c891ba75481fd657/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/_delta.py#L127)