SQL Prettifier formats SQL with configurable indentation and keyword casing across PostgreSQL, MySQL, SQLite, and MSSQL dialects. The Dialect Transpiler converts between dialects, handling ILIKE, :: cast, TINYINT(1), LIMIT/OFFSET vs TOP/FETCH, RETURNING clauses, and identifier quoting. Each translation includes a reason so agents can audit migration work.
SQL Prettifier
Format SQL and translate between PostgreSQL, MySQL, SQLite, and MSSQL
How to use
- Paste SQL — Drop in the SQL query you want to format. Single or multi-statement scripts both work.
- Pick the source dialect — postgres, mysql, sqlite, or mssql — controls how the input is parsed for translation.
- Configure formatting — Set indentSize (default 2) and toggle uppercase keyword casing (default on).
- Optional: pick a target dialect — Set translateTo to convert dialect-specific syntax (ILIKE, :: cast, TOP, etc.).
- Run — Click Format or press Ctrl+Enter. The formatted SQL appears; if translation was requested, the translated SQL plus a per-change list and warnings appear below.
MCP / API
Call sql_prettifier directly from any MCP-compatible agent:
// MCP TypeScript SDK
const result = await client.callTool({
name: "sql_prettifier",
arguments: {
"sql": "...",
"dialect": "postgres"
}
});
// curl
curl -X POST https://obfus.link/mcp \
-H "Authorization: Bearer <SPT>" \
-H "Content-Type: application/json" \
-d '{"method":"tools/call","params":{"name":"sql_prettifier","arguments":{"sql":"...","dialect":"postgres"}}}'Related tools
FAQ
Which dialect-specific constructs are translated?
PostgreSQL → MySQL: ILIKE → LOWER(...) LIKE LOWER(...), :: cast → CAST(... AS ...), || string concat → CONCAT(), RETURNING → warning. PostgreSQL → MSSQL: LIMIT/OFFSET → OFFSET/FETCH NEXT, RETURNING → warning. MySQL → PostgreSQL: TINYINT(1) → BOOLEAN, backtick identifiers → double-quoted. MSSQL → PostgreSQL: SELECT TOP n → LIMIT n. PostgreSQL → SQLite: :: cast → CAST(... AS ...).
Will it execute the SQL?
No. SQL Prettifier is a pure transform — it only formats and translates the query string. It has no database connection, no execution path, and no destructive capabilities.
How does the translations array work?
Each dialect-specific change is logged as a {original, translated, reason} entry. Agents use this array to summarise migration work to a human reviewer or to generate a structured change list for a pull-request description.
Why did I get a warning instead of a translation?
Some constructs have no clean equivalent in the target dialect (e.g., RETURNING in MySQL, PostgreSQL full-text in SQLite). Rather than silently produce broken SQL, those land in the warnings array so you can address them manually.
Can I use this tool via the MCP API?
Yes. The tool is registered as sql_prettifier on the obfus.link MCP server at https://obfus.link/mcp. Call it from any MCP-compatible agent with a Shared Payment Token. The MCP tool name matches the snake_case slug shown in the integration snippet.