robson poffo
All projects

May 2026

Parse SQL

A paste-and-go web app: drop in SQL and instantly get a pretty-printed version, an interactive AST view, and a checklist of query-optimization warnings across a dozen dialects.

SQLPythonFastAPIsqlglotASTGoogle Cloud RunFirebase HostingServerless
Parse SQL — SQL parsed into an abstract syntax tree across 12 dialects

Overview

Parse SQL is a no-signup web tool that takes raw SQL and returns three things — a formatted version, the parsed AST as a collapsible tree, and a set of optimization findings. It parses and transpiles across 12 dialects (BigQuery, PostgreSQL, MySQL, Snowflake, T-SQL, Redshift, DuckDB, Oracle, SQLite, Trino/Presto, Spark SQL, ClickHouse), auto-detecting the dialect when you don't pick one.

Engineering highlights

  • AST-based parsing on sqlglot — parses SQL into expression trees, pretty-prints in the target dialect, and serializes the AST to a collapsible JSON tree.
  • Heuristic dialect auto-detection — scores SQL against per-dialect marker sets, picks the best match, and falls back across candidates when the first parse fails.
  • Optimization analyzer as AST-walking rules — ~13 rules flag SELECT *, redundant DISTINCT + GROUP BY, implicit cross-joins, leading-wildcard LIKE, NOT IN (subquery) NULL traps, UNION vs UNION ALL, and more, graded info / warning / error.
  • Fingerprint cache + rate limiting — each parse is keyed by a SHA-256 of canonicalized SQL so identical queries return instantly; a per-IP daily limit exempts cache hits, and client IPs are stored hashed.
  • Serverless, scale-to-zero — FastAPI on Cloud Run behind Firebase Hosting (static frontend on the edge CDN, /api/** rewritten same-origin), all provisioned via Terraform.

Stack

Python 3.12 · FastAPI · sqlglot · Google Cloud Firestore · Google Cloud Run · Firebase Hosting · Terraform · Docker