SQLTerrain

Local-first SQL reasoning workbench

Map the logic behind your SQL.

Paste a query and see its output grain, column lineage and join risk, computed from the SQL itself, in this tab, by a parser rather than a model.

Query route mapExample analysis of the worked query. Not a live run.customersordersLEFT JOIN + WHEREResultLEFT_JOIN_WHERE_RIGHT
1 join · grain: one row per segment · 1 warningExample analysis of the worked query. Not a live run.

The query runs. That is not the same as being right.

A LEFT JOIN with a WHERE clause on the right-hand table silently becomes an inner join. A GROUP BY you did not expect changes what one row means. A column you traced through four CTEs came from somewhere else entirely. None of it errors. All of it ships.

One query. Four ways to be sure of it.

Four tools, one query. Below, the same SQL is read as a route, moved to another dialect, measured against real files, and rebuilt from blocks.

Input SQL
SELECT c.segment, SUM(o.amount) AS revenue
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.id
WHERE o.status = 'paid'
GROUP BY c.segment;
customersordersLEFT JOINWHEREGROUP BYoutput
LEFT JOIN filtered by WHERE on the right tableGrain: one row per segment

Paste a query; Atlas maps the route and reports the output grain, join risks, and column lineage before you trust the result.

Open Atlas

Local-first, deterministic

Runs in your browser. SQL is not uploaded.

Parser and rules, not an LLM. The same query always maps the same way.

Dialects it reads

PostgreSQLMySQLSQLiteBigQueryexpSnowflakeexpSawitDB

Full test corpus: PostgreSQL, MySQL, SQLite, SawitDB · Experimental: BigQuery, Snowflake

A LEFT JOIN that quietly loses customers.

Scroll to trace how one WHERE clause turns a LEFT JOIN into an inner join, and what Atlas reports about it.

Trace it in Atlas

The query

SELECT c.segment, SUM(o.amount) AS revenueFROM customers cLEFT JOIN orders o ON o.customer_id = c.idWHERE o.status = 'paid'GROUP BY c.segment;

The route

customers and orders flow through the join and filter into the grouped result.

The risk

The WHERE predicate filters orders, the right-hand side of the LEFT JOIN. Unmatched customers arrive with NULL order columns, fail the predicate, and disappear: the LEFT JOIN quietly behaves like an inner join.

LEFT_JOIN_WHERE_RIGHT

The consequence

Atlas flags the risky step (LEFT_JOIN_WHERE_RIGHT) and names the output grain: one row per segment.

Grain: one row per segment

What it knows, and what it cannot.

Every finding comes from parsing the SQL: one parser, one rule set, no model. The same query always produces the same answer, and each finding names the rule that raised it.

SQL alone cannot tell you whether a join key is unique, how many rows a filter drops, or whether a column is ever NULL in practice. Atlas will not guess at those. Survey measures them against your own files, and anything neither can prove is labelled unproven rather than asserted.

Built for analysts and engineers who inherit SQL they did not write, and have to be sure of it before it reaches a dashboard.

Field Notes

Release notes, fixes, and what I learned building SQLTerrain.

Start with the query you trust least.