Declarative ClickHouse streaming pipelines with replay-aware builds and staged deployments.
StreamBuild compiles typed SQL models into ClickHouse tables and materialized views, plans the affected graph, and rebuilds it from retained streaming history.
- Direct mode rebuilds selected live relations immediately.
- Virtual mode builds deployment-specific relations for review, audit, promotion, and rollback.
- Mixed mode stages virtual pipelines before applying direct pipelines in one invocation.
StreamBuild currently targets ClickHouse. It supports managed Kafka landing and adopted external stream tables.
Install
Requires Python 3.12 or newer.
pip install streambuild
stb --help
For repository development:
uv sync
uv run stb --help
Project
streambuild_project.toml
sources/
orders.yml
macros/
common.py
pipelines/
orders/
pipeline.toml
order_totals.sql
audits/
tests/
Each direct child of pipelines/ is a pipeline. SQL filenames define logical model names, and
StreamBuild infers pipeline sources by following __source() and __ref() dependencies.
Minimal configuration:
name = "orders"
default_target = "dev"
[connection]
host = "localhost"
port = 8123
username = "default"
password = "${ENV:CLICKHOUSE_PASSWORD}"
[defaults]
pipeline_mode = "direct"
run_presumed_failed_after = "10m"
[targets.dev]
database = "analytics"
Developer-specific target and connection overrides belong in the gitignored
streambuild_local.toml.
Sources
Managed Kafka source:
sources:
- name: orders
kind: kafka
broker_list: kafka:9092
topic: source.orders
replay_boundary:
mode: offsets
Adopted ClickHouse source:
sources:
- name: orders
kind: stream_table
table_name: orders_existing
replay_boundary:
mode: offsets
columns:
_replay_partition: event_partition
_replay_offset: event_offset
_replay_timestamp: event_time
StreamBuild owns managed Kafka landing objects. It validates but never mutates adopted source tables.
Models
MODEL (
engine "MergeTree()",
order_by ["order_id", "_replay_partition", "_replay_offset"],
);
SELECT
order_id::String AS order_id,
_replay_partition::Int32 AS _replay_partition,
_replay_offset::Int64 AS _replay_offset,
_replay_timestamp::DateTime64(3) AS _replay_timestamp
FROM __source("orders")
Models must project explicit output types. Table models preserve replay lineage through normalized
_replay_* columns. Terminal query views use MODEL (kind view).
Python functions under macros/ are available in model, test, and audit SQL as @function_name().
Workflow
stb discover # inspect authored resources
stb compile # offline validation and artifacts
stb plan # read-only warehouse plan
stb build # confirm and execute
stb test
stb audit
stb dev # local UI at 127.0.0.1:8000
Select a model or pipeline with repeatable selectors:
stb plan --select pipeline:orders
stb build --select order_totals --start-time 2026-08-01T00:00:00Z
Protected pipelines require their exact configured --confirm value even with
--auto-approve.
Deployments
Set pipeline_mode = "virtual" project-wide or mode = "virtual" in pipeline.toml.
stb build
stb deployment list
stb deployment show <deployment-id>
stb deployment diff <deployment-id>
stb deployment audit <deployment-id>
stb deployment promote <deployment-id>
stb deployment rollback --previous
Promotion and rollback switch stable views one relation at a time. Rollback restores a retained publication's bindings, not a historical data snapshot.
Development UI
stb dev serves one resolved project and target. The UI provides:
- overview, lineage, pipeline, catalog, source, topic, and message inspection
- connected plan previews and protected-pipeline confirmation
- direct, virtual, and mixed build execution
- deployment inventory, diff, promotion, and cleanup
- durable run timelines, statement progress, cancellation, and stale-run recovery guidance
- audit history and scheduler health
Run observability is warehouse-backed. A silent run becomes unresponsive after 45 seconds and
presumed_failed after [defaults].run_presumed_failed_after (default 10m). A new build is blocked
until that safety window expires to prevent overlapping warehouse writes.
Guarantees
stb compileis connection-free and writes disposable artifacts undertarget/.stb planis read-only;stb buildalways replans against current warehouse state.- Lifecycle state is append-only metadata in the selected target database.
- Failed or cancelled builds are rerun, never resumed from copied SQL artifacts.
- Workflow statements execute serially to avoid unbounded ClickHouse memory pressure.
Documentation
Development
make check-ci
make test
make test-all
make ui-build
Tests are split across tests/unit, tests/integration, and tests/e2e.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streambuild-0.16.6.tar.gz.
File metadata
- Download URL: streambuild-0.16.6.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
657ee92be551dfbb7d67ba351c4dfede223e9dea636158c0dcbc5dac20670cab
|
|
| MD5 |
c65d454cac44b7a4f2770109e593ba1e
|
|
| BLAKE2b-256 |
636b470e1c8f9425d3dd0775849b8bf43e0b32c5b856d75cbaf1876fd6231d78
|
Provenance
The following attestation bundles were made for streambuild-0.16.6.tar.gz:
Publisher:
publish.yml on chio-labs/streambuild
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
streambuild-0.16.6.tar.gz -
Subject digest:
657ee92be551dfbb7d67ba351c4dfede223e9dea636158c0dcbc5dac20670cab - Sigstore transparency entry: 2397188464
- Sigstore integration time:
-
Permalink:
chio-labs/streambuild@9f2694d15c9857c3e73309e43336b818edc7373f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/chio-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f2694d15c9857c3e73309e43336b818edc7373f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file streambuild-0.16.6-py3-none-any.whl.
File metadata
- Download URL: streambuild-0.16.6-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76efde6b7339f39d9be73f9e3e66bd3d224d09202c57b6c2f56e3adfc14e24c1
|
|
| MD5 |
8426c0167cffb2de0050536def65cb70
|
|
| BLAKE2b-256 |
987655b4beb2d11add199284e1a286946be270b2466efcd575e6223cfcdc5ac6
|
Provenance
The following attestation bundles were made for streambuild-0.16.6-py3-none-any.whl:
Publisher:
publish.yml on chio-labs/streambuild
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
streambuild-0.16.6-py3-none-any.whl -
Subject digest:
76efde6b7339f39d9be73f9e3e66bd3d224d09202c57b6c2f56e3adfc14e24c1 - Sigstore transparency entry: 2397188536
- Sigstore integration time:
-
Permalink:
chio-labs/streambuild@9f2694d15c9857c3e73309e43336b818edc7373f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/chio-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9f2694d15c9857c3e73309e43336b818edc7373f -
Trigger Event:
workflow_dispatch
-
Statement type: