Breaking changes
selectjoin check tells you the project is valid. selectjoin diff tells you what changed for everyone who reads your tables: dashboards, exports, other teams. It compares the shape of every model with an earlier state of the project.
A model’s shape is its table name, its columns and their types, and its grain. Rewriting a query without changing its shape is not reported.
Compare with a git ref
Section titled “Compare with a git ref”selectjoin diff --against mainSince main: 4 breaking, 1 other.BREAKING int_order_customer_features column type changed: loyalty_discount_rate DECIMAL(5, 4) -> DECIMAL(8, 4)BREAKING int_orders_customers column type changed: loyalty_discount_rate DECIMAL(5, 4) -> DECIMAL(8, 4)BREAKING mart_customer_revenue column removed: loyalty_adjusted_revenue (DECIMAL(18, 2))BREAKING stg_customers column type changed: loyalty_discount_rate DECIMAL(5, 4) -> DECIMAL(8, 4)ok mart_customer_revenue column added: average_order_value (DOUBLE)Two edits produced this: a cast changed in stg_customers, and one column was swapped for another in the mart. The type change shows up on every model the column flows through, because SelectJoin tracks types across the graph.
--against takes any git ref: a branch, a tag, or HEAD~1. SelectJoin reads the project as it was at that ref into a temporary folder and compiles it there. Your working tree is not touched, and uncommitted edits are part of the comparison.
The command exits with code 1 when there is a breaking change, so it can gate a pull request:
selectjoin diff --against origin/mainWhat counts as breaking
Section titled “What counts as breaking”| Change | Breaking |
|---|---|
| Model or source removed | Yes |
| Column removed | Yes |
| Column type changed | Yes |
| Grain changed | Yes |
Table name (relation) changed |
Yes |
| Column added | No |
| Model or source added | No |
| Materialization changed | No |
Renaming a column is reported as one column removed and one added. Column order and descriptions are not compared.
JSON output
Section titled “JSON output”selectjoin diff --against main --json{ "against": "main", "breaking": 1, "changes": [ { "unit": "mart_customer_revenue", "breaking": true, "change": "column_removed", "column": "loyalty_adjusted_revenue", "detail": "column removed: loyalty_adjusted_revenue (DECIMAL(18, 2))" }, { "unit": "mart_customer_revenue", "breaking": false, "change": "column_added", "column": "average_order_value", "detail": "column added: average_order_value (DOUBLE)" } ]}change is one of unit_removed, unit_added, relation_changed, grain_changed, materialization_changed, column_removed, column_type_changed, column_added, and columns_unknown.
Compare with a saved contract
Section titled “Compare with a saved contract”Outside git, or to compare with what is deployed, save the shape of the project to a file and compare with that:
selectjoin contract --output contract.jsonselectjoin diff --against contract.jsonselectjoin contract prints the same JSON to the terminal when you leave out --output. It refuses to replace an existing file without --force.
Limits
Section titled “Limits”- A model whose columns are unknown, because a source has no declared schema, cannot be compared column by column. It is reported once as
columns_unknown. - Models imported from packages are not included: they belong to another project.
- The earlier version must compile. If it does not, the command says so and stops.
- Comparing with a git ref runs the Python of that older commit, as loading the project always does.
- There are no model versions yet. A breaking change is reported, but SelectJoin cannot keep the old and new shape side by side.