Skip to main content

SQL Formatter & Converter

Format or minify SQL queries safely, merge MyBatis Preparing/Parameters logs into runnable SQL, and convert CREATE TABLE DDL to TypeScript, Go, or Java models.

Free & Open Source Developer sql format minify mybatis
Version 1.0.4 Updated 2026-11-25
Download ZTools to Install Install ZTools, then search for "SQL Formatter & Converter" in the Plugin Marketplace

Screenshots

SQL Formatter & Converter - Preview 1

Key Features

Format or minify SQL while preserving identifiers, strings, and comments

format sql / sql formatter / beautify sql / minify sql

Merge MyBatis Preparing and Parameters logs into reconstructed SQL

mybatis / mybatis sql / merge sql params / mybatis log

Convert CREATE TABLE DDL statements into TypeScript, Go, or Java entity models

ddl to entity / sql to ts / sql to go / sql to java / create table

Overview & Usage Guide

Perform SQL formatting, MyBatis log parameter verification, and CREATE TABLE field model generation locally in the client. Does not connect to any database or execute the input SQL.

Search format sql, mybatis, or ddl to entity to jump directly to the corresponding tool. Press Enter to load from the clipboard, or ⌘/Ctrl+Enter to open the multiline editor; inside the editor, select the SQL dialect and press ⌘/Ctrl+Enter to generate results. The search box filters output formats only; press Enter to copy the current result, and Esc to cancel editing. Each of the three tools retains its own input during the current session.

  • Format & Minify: Adjusts only whitespace between lexical tokens while preserving casing, identifiers, strings, and comments. Line comments and existing line breaks in PostgreSQL are preserved, so minified output is not guaranteed to be a single line. This is not a database syntax validator.
  • MyBatis: Paste the complete Preparing and Parameters lines from the same call. Mismatched counts, multiple log groups, continuation lines, unrecognized types, or ambiguities stop processing. Replaces only ? placeholders in code while skipping strings and comments. Output is for verification reference only; logs have no lossless escaping protocol and are not an exact substitute for JDBC parameter binding. Dates, timezones, and custom types in particular require manual verification.
  • DDL Models: Processes one table at a time, splitting fields by parenthesis depth and quotes, supporting single-line and multiline declarations, common types, and table-level primary keys. Generates TypeScript interfaces, Go structs with JSON/GORM column tags, and Java classes without Lombok. Actual field types depend on the SQL dialect and driver; generated output is an editable model skeleton, not a database migration validator. Unknown types are flagged clearly, and unrecognized structures do not produce partial output.
  • bigint and exact decimals avoid precision loss via JavaScript number; nullable fields use | null in TS and pointers in Go. MySQL tinyint(1) / BOOL still map as integers, and TIME maps as a duration string. SQLite integers are treated as 64-bit; non-integer primary keys in regular tables remain nullable, while INTEGER rowid, STRICT, and WITHOUT ROWID tables are handled specifically.
  • Column names that cannot be reliably represented in Go JSON/GORM tags (such as commas, semicolons, quotes, backslashes, or a standalone -) block generation; use explicit field aliases first. JSON key names are never silently altered and extra ORM settings are not injected.

Supports MySQL default backslash escaping, PostgreSQL standard strings, and SQLite lexical modes. When using different settings such as MySQL NO_BACKSLASH_ESCAPES / ANSI_QUOTES or PostgreSQL with standard_conforming_strings disabled, do not interpret literals directly with default mode. Vendor-specific extensions, stored procedures, and full constraint validation are outside the scope of field model extraction.

Input is limited to 256 KiB, up to 50,000 SQL tokens, 64 levels of parentheses, 500 MyBatis parameters, and 1,000 model columns. Failures display the reason; invalid edits do not overwrite existing valid content, and invalid clipboard input clears old output so stale results are not copied by mistake.

Platforms & Requirements

  • Supported: Windows, macOS

Network & Data

  • Offline only; data is stored locally only.

Frequently Asked Questions (FAQ)

How do I install and launch "SQL Formatter & Converter" in ZTools?

Open the Plugin Marketplace inside ZTools Workbench, search for "SQL Formatter & Converter", and install it. Then type its name in the launcher bar to open it.

Is "SQL Formatter & Converter" free? Which platforms are supported?

Yes, it is free to install with source code published in the ZTools-extensions repository. Supported platforms: Windows / macOS.