Inject parameters into raw SQL and format the result — CLI & web tool.
# one query
sqlformat "SELECT * FROM t WHERE id = ?" "[42]"
# batch from file (pairs: SQL line, params line)
cat queries.txt | sqlformat > formatted.sqlsudo npm install -g format-my-sqlor via npx:
npx -p format-my-sql sqlformat "SELECT * FROM t WHERE id = ?" "[42]"| Style | Example | Params |
|---|---|---|
? |
WHERE id = ? |
[1] |
$1 |
WHERE id = $1 |
[1] |
:name |
WHERE id = :id |
{"id":1} |
Client-side only, no backend → formatmysql.vercel.app
MIT