Skip to content

Compare

SQLBuild vs SQLMesh

SQLMesh needs a state database. SQLBuild keeps its state in your warehouse.

SQLMesh keeps its state in a separate database, and its docs recommend PostgreSQL for production. SQLBuild records its state in append-only tables in your warehouse and reads it back when it plans. There is nothing else to host, back up or keep in sync.

$ sqb plan
Connecting to duckdb...
✓ Warehouse connected duckdb (0.06s)
Inspecting warehouse state...
✓ Warehouse state inspected (0.03s)
…

See Planning.

A SQLMesh unit test checks one model, with every model it reads mocked. A SQLBuild test mocks the sources and runs every model in between, on DuckDB on your laptop or on the warehouse.

SQLBuild SQLMesh
Tests across several models Mock the sources, run every model in between One model, every parent mocked
End-to-end scenarios Source fixtures through the real model graph No
Whole pipeline on your laptop Warehouse SQL converted to DuckDB One model at a time
Macro, UDF and table function tests Yes No
Typed, parameterised cases Yes No
Assertions inside tests __assert__ CTEs No; audits run on built tables

Here the first test runs three real models from mocked sources:

$ sqb test
Tests ready 4 selected, 4 local
1/4 test test_daily_revenue_chain PASS local 0.02s 3 real models
2/4 test test_fact_orders PASS local 0.01s 1 real model
3/4 test calculates_line_total_cents PASS local 0.01s
4/4 test test_stg_orders PASS local 0.01s 1 real model
✓ Completed successfully PASS=4 FAIL=0 TOTAL=4 (0.43s)

See Tests and Scenarios.

SQLMesh’s linter checks models, and only once you turn it on. SQLBuild Rules run in every compile and cover the whole project, so a review comment becomes an error that points at the line.

SQLBuild SQLMesh
Built-in rules 205 7
When they run Every compile sqlmesh plan and sqlmesh lint, once enabled
What they check Models, the graph, tests, jobs and sensors, and your Python code Models
Exceptions In sqlbuild_project.toml, each with a reason, flagged once stale A list of ignored rules

You write custom rules in Python, and they read the compiler’s facts through SQLBuild’s Rust API, with results cached per model. On the 10,000-model benchmark, every built-in rule plus a custom Python rule adds 6 s to a cold compile, and a one-model edit recompiles in 4.2 s.

Here a team rule stops a mart reading a raw source directly:

rules/layers.py
@rule(
code="XSQBRARCH001",
message="Marts must read sources through staging",
remediation="Reference a staging model with __ref() instead.",
)
def marts_use_staging(*, model: Model, ctx: RuleContext) -> list[Finding]:
layer = ctx.project.tree.relative_parts(path=model.path, under="models")[0]
sql = ctx.sql.for_model(model).authored.source
if layer != "marts" or "__source(" not in sql:
return []
line = sql[: sql.index("__source(")].count("\n") + 1
return [ctx.finding(subject=model, line=line)]
$ sqb compile
error[XSQBRARCH001]: Marts must read sources through staging
--> models/marts/daily_revenue.sql:24:1
|
24 | INNER JOIN __source("raw__payments") p ON o.order_id = p.order_id
| ^
= help: Reference a staging model with __ref() instead.

See Rules and Findings and exceptions.

SQLMesh has no rename command, so a renamed model is a new model, built from scratch. With sqb mv, the plan moves the existing table to the new name, and the old name keeps working as a view.

$ sqb mv hourly_order_activity sql/models/reporting/order_activity_by_hour.sql
…
Compiled: ok, 5 files changed
$ sqb plan
Migrations (1)
└── order_activity_by_hour migrate dev.hourly_order_activity -> dev.order_activity_by_hour
├── compatibility compatible
├── transfer physical copy, promote by transactional rename
└── old name dev.hourly_order_activity
├── view until 2027-01-03
└── old table archived

See Refactoring.

SQLMesh covers the transform. SQLBuild also loads your sources, runs your Python steps and schedules your jobs, with a web UI and SSO included.

SQLBuild SQLMesh
Loading sources A SQLLoad source in your sources file, or a Python @loader, loaded inside the build A separate tool
Python steps Exports, API calls and checks as @asset and @check nodes in your build A separate orchestrator
Scheduler Included, self-hosted sqlmesh run from your own cron, or Tobiko Cloud
Web UI Included, self-hosted Browser UI deprecated in favour of a VS Code extension
SSO and roles Free, with roles down to the model Not in open-source SQLMesh
SQLBuild Web UI run graph showing loaded sources, a seed, staging views and marts tables, all succeededSQLBuild Web UI run graph showing loaded sources, a seed, staging views and marts tables, all succeeded
One job run in the SQLBuild UI: loading, seeds and models in a single graph.

See Sources, Python nodes and the Web UI.

Every feature, side by side, is in the Feature Comparison.