sqlalign GitHub

sqlalign is a SQL formatter that produces columnar, aligned output — and re-parses every statement it writes to prove it did not change what the SQL means.

In:

select cust.customer_id, cust.email, sum(ord.total) as lifetime_value from customers cust inner join orders ord on ord.customer_id = cust.customer_id where ord.order_date >= '2026-07-01' group by cust.customer_id, cust.email;

Out:

SELECT cust.customer_id
     , cust.email
     , SUM(ord.total) AS lifetime_value
FROM customers    cust
INNER JOIN orders ord ON ord.customer_id = cust.customer_id
WHERE ord.order_date >= '2026-07-01'
GROUP BY cust.customer_id
       , cust.email;

The guarantee#

Every statement is re-parsed after formatting and compared against the input as a syntax tree. If the output would differ semantically — or if the engine does not fully model the construct — that statement is passed through byte-identical with a warning instead. A passthrough is not a failure, and the run still exits 0.

Pages#