How SQL Formatter Works
Engineered for high-fidelity SQL formatting across 9+ database dialects with native AST parsers, side-by-side Git diff verification, and a zero-data-retention privacy policy.
Core Architecture & AST Engine
Understanding why Abstract Syntax Tree parsing delivers superior reliability over regular expressions.
GoogleSQL & ZetaSQL AST
BigQuery queries are parsed using native GoogleSQL / ZetaSQL C++ engines. This supports complex GoogleSQL features including Pipe Syntax (|>), STRUCTs, ARRAYs, and procedural scripts without token corruption.
SQLFusion Rust Engine
PostgreSQL, MySQL, SQL Server, ClickHouse, Snowflake, DuckDB, SQLite, and ANSI queries are formatted using SQLFusion, a high-performance AST engine written in Rust built on Apache DataFusion sqlparser-rs that handles dialect-specific syntax quirks.
Git Diff Inspection
Integrated Git-style diff inspection visualizes every line break, keyword case adjustment, and indentation change before you copy or apply queries to production.
Privacy-First & Zero Retention Guarantee
Enterprise-ready security boundaryWe understand that SQL queries often contain sensitive database schemas, proprietary business logic, and internal identifiers. Our system operates under strict privacy principles:
Supported Dialects Breakdown
Engine support and key capabilities across all supported SQL dialects.
| Dialect | Engine | Key Capabilities |
|---|---|---|
| BigQuery (GoogleSQL) | GoogleSQL | Native GoogleSQL & ZetaSQL AST parsing engine · Full support for ARRAYs, STRUCTs, and UNNEST expressions · GoogleSQL Pipe Syntax (|>) support · Multi-statement procedural scripts & DDL formatting · Backtick-escaped project and dataset identifiers |
| PostgreSQL | SQLFusion | Recursive CTEs and Common Table Expressions · JSON and JSONB path extraction operators (->, ->>, #>) · Window functions with PARTITION BY and custom frame specifications · FILTER (WHERE ...) aggregation clauses · Dollar-quoted string literals and arrays |
| MySQL | SQLFusion | Backtick identifier escaping (`table`.`column`) · HAVING and GROUP BY clauses with aggregate filters · String and date functions (DATE_FORMAT, COALESCE, IFNULL) · INNER, LEFT, RIGHT, and FULL OUTER JOIN indentation |
| SQL Server (T-SQL) | SQLFusion | Square bracket identifier escaping ([dbo].[TableName]) · TOP (N) and OFFSET-FETCH pagination clauses · CROSS APPLY and OUTER APPLY joins · Common Table Expressions (WITH CTE) |
| ClickHouse | SQLFusion | ClickHouse PREWHERE and WHERE clauses · Nested aggregation combinators (-State, -Merge, -ExactWeighted) · Array manipulation and lambda functions · DateTime functions and interval expressions |
| Snowflake | SQLFusion | Snowflake colon type casting (::type) · Semi-structured JSON path queries and FLATTEN · Stage references and warehouse commands · Window functions and analytical clauses |
| DuckDB | SQLFusion | DuckDB parquet, JSON, and CSV reader functions · List and struct transformations · QUALIFY clauses and regex matching · Positional reference and columns expression |
| SQLite | SQLFusion | Standard SQLite queries and PRAGMA statements · JSON functions (json_extract, ->, ->>) · CTE and window function support · Transactions and savepoints |
| Generic / ANSI SQL | SQLFusion | Standard ANSI SQL:1999/2011 compliant formatting · Common Table Expressions (WITH clauses) · Standard JOINs (INNER, LEFT, RIGHT, FULL OUTER) · Window functions and aggregate subqueries |
Frequently Asked Questions
Answers to common questions regarding formatting, dialect behavior, and features.
What makes this formatter different from traditional online SQL formatters?▼
Which parsing engines power the formatters?▼
Is my SQL query saved, logged, or retained on your servers?▼
Does the formatter support multi-statement SQL scripts?▼
always_break_query).How does the side-by-side Git diff viewer work?▼
Does the formatter support GoogleSQL Pipe Syntax (|>)?▼
|> WHERE, |> AGGREGATE, |> EXTEND, |> SET, |> JOIN, and |> WINDOW with custom pipe breaking rules.What happens if my query contains syntax errors?▼
Is there an API available for programmatic formatting or CI/CD pipelines?▼
Ready to format your queries?
Try our instant multi-dialect formatter with live diff inspection and custom formatting rules.
Open SQL Formatter