SQL Formatter comparisons

Steve Culshaw edited this page Sep 20, 2018 · 9 revisions

The original Poor Man's T-SQL Formatter project page at http://architectshack.com/PoorMansTSqlFormatter.ashx had a comparison table featuring all the then-available T-SQL formatters I could find, and my best effort at measuring/comparing their capabilities and properties.

This approach had a number of issues:

  1. I was not able to compare all the engines effectively, because many were only available as apps / UI tools
  2. I ended up comparing different types of things (libraries, utilities, alls, sites)
  3. I let the comparison table even as it gradually fell out of date and became unfair/incorrect and (even more) incomplete

Despite these issues, I do believe that there is value in a project in a competitive space evaluating itself critically, and making the resulting information available publically - both as a tool to help improve (on the right things), and as a marketing device.

So I'm starting again here, in a publically editable wiki page this time so that corrections can be more easily provided by whoever has the information.

This time the comparison will be broken out by "product", to facilitate relevant comparisons from a user's perspective:

SQL Formatting Libraries

Product SQL Dialects Price License Source Runtimes
Poor Man's T-SQL Formatter T-SQL, others Free AGPL3 C# .Net, JS
Sql Format (Laan) T-SQL, ?? Free BSD C# .Net
python-sqlparse ?? Free BSD Python Python, ??
FSQLF Basic SQL Free LGPL3 C and LEX C, Python, ??
pgFormatter PostGre, others Free PostgreSQL Licence Perl Perl
sql-parser (npm) Basic SQL Free MIT CoffeeScript JS
SqlFormatter (jdorn/PHP) Standard SQL Free MIT PHP PHP
vkbeautify Basic SQL Free MIT JS JS
sql-formatter (npm) sql / n1ql / db2 Free MIT JS JS
mssql vscode language service T-SQL N/A ?? ?? ??
SqlDeveloper (oracle) Oracle SQL, PL/SQL N/A OTN License (closed) C / CLI
General SQL Parser Many / All $500+ Comm. (closed) C, COM, .Net, Java
SqlInForm Many / All N/A N/A (closed) Java (, .Net? JNI?)
SoftTree Many / All N/A N/A (closed) ??
TidyCode Many / All N/A N/A (closed) ??
DevArt T-SQL N/A N/A (closed) ??
TSQLTidy T-SQL N/A N/A (closed) ??
SSMSToolPack T-SQL N/A N/A (closed) ??
ApexSQL T-SQL N/A N/A (closed) ??
RedGate T-SQL N/A N/A (closed) ??
SqlEnlight T-SQL N/A N/A (closed) ??
SimpleTalk Basic SQL?? N/A N/A (closed) ??

(please note: there are many others that I haven't tracked here because they don't seem to be used in any online formatter or editor plugin "products". I suspect that's because they're too simplistic to be useful in most scenarios, but I don't know that, haven't done the research. I started seeing a bunch of these, for example, when I searched "npm sql-parser" in google)

Online Formatters

Product Library "Calls Home" / Online-only
http://poorsql.com Poor Man No - works offline
DevArt SQL Formatter DevArt Yes
Instant SQL Formatter General SQL Parser Yes
Laan Sql Format Sql Format (Laan) Yes
T-SQL Tidy TSqlTidy Yes
Simple-Talk Code Prettifier SimpleTalk Yes
Ubitsoft T-SQL Beautifier SqlEnlight Yes
https://sqlformat.org/ python-sqlparse Yes
pgFormatter pgFormatter Yes
SQL Formatter (zeroturnaround) sql-formatter (npm) No

Not yet looked at:

Ignored/discounted:

  • SQLInForm not listed - 100-line limitation makes it "just a demo"
  • Manoli.net site appears to have gone
  • https://www.cleancss.com/sql-beautify/ not listed because it's not a SQL beautifier at all, at best acts as a minifier and colorizer: It's actually a JS beautifier

Verdict: It's understandable and fair that http://www.sql-format.com/ beats the pants off http://poorsql.com for online formatting search engine positioning. No-one cares whether it's open-source, and it does expose a lot more formatting options. These other generic transformation hub sites should be beatable, they are offering no value, clearly some SEO work is warranted here.

(related: traffic stats for http://poorsql.com/ show a sudden and dramatic slowing of traffic, 30% down in a few months, at the tail end of 2015. That is probably around when http://www.sql-format.com/ was introduced. http://poorsql.com/ has never recovered - possibly/probably due to project inactivity, traffic growth has stopped and it's currently stable around 1,500 visits/day)

Command-Line Formatters

Product Library SQL Dialects "Calls Home" / Online-only
Poor Man's T-SQL Formatter - .Net Poor Man's T-SQL Formatter T-SQL, others No - works offline
poor-mans-t-sql-formatter-cli - NPM Poor Man's T-SQL Formatter T-SQL, others No - works offline
SQL Pretty Printer Desktop General SQL Parser Many / All ??
SqlInform Pro SqlInForm Many / All ??
Sql Enlight SqlEnlight T-SQL, Others?? ??
SoftTree SQL Assistant SoftTree Many / All ??
TidyCode T-SQL Formatter TidyCode Many / All ??
SqlDeveloper (oracle) SqlDeveloper Oracle SQL, PL/SQL No - works offline
FSQLF FSQLF Basic SQL No - works offline

(Note: SQLInForm's and SoftTree's ability to run as a command-line formatting utility is assumed, not tested)

Note: This list is still very incomplete - I have not explicitly searched for command-line formatters yet, these are just the ones I previously knew about. All of the open-source libraries are likely to have had Cmdline Formatters created for them

SSMS Extensions

Product Library "Calls Home" / Online-only Syntax Coverage Configurability
Poor Man's T-SQL Formatter Same No - works offline High Medium
SQL Pretty Printer SSMS General SQL Parser ?? High? High?
SSMS Tools Pack Poor SQL or SSMSToolPack ?? High? ??
ApexSQL Refactor ApexSQL ?? ?? High
SQL Prompt RedGate ?? ?? High
SqlInform Pro SqlInForm No? ?? High?
DevArt SQLComplete DevArt No? High? High?
SQL Enlight SqlEnlight ?? High? ??
SoftTree SQL Assistant SoftTree ?? High? High?

(Laan SSMS tools not listed, they appear to exist in source code only, no release, and currently no SSMS 2016-2017 support)

(T-SQL Tidy not listed, appears not to have been updated for SSMS since 2008)

Visual Studio Extensions

Product Library SQL Dialects "Calls Home" / Online-only
Poor Man's T-SQL Formatter Same T-SQL, others No - works offline
SQL Pretty Printer VS General SQL Parser Many / All ??
SqlInform Pro SqlInForm Many / All No?
SoftTree SQL Assistant SoftTree Many / All ??

Notepad++ Formatters

Product Library SQL Dialects "Calls Home" / Online-only
Poor Man's T-SQL Formatter Same T-SQL, others No - works offline
Instant SQL Formatter for NPP General SQL Parser Many / All Yes
SqlInform Free SqlInForm Many / All ??
SqlInform Pro SqlInForm Many / All No?
SoftTree SQL Assistant SoftTree Many / All ??

Atom Editor Formatters

Product Library SQL Dialects "Calls Home" / Online-only
poor-mans-t-sql-formatter Poor Man's T-SQL, others No - works offline
atom-beautify python-sqlparse (separate pip install) ?? No - works offline
atom-pg-formatter pgFormatter (needs perl runtime) PostGre, others No - works offline
atom-format-sql sql-parser (npm) ?? No - works offline
atom-oracle-format SqlDeveloper Oracle SQL, PL/SQL No - works offline

VS Code Formatters

Product Library SQL Dialects "Calls Home" / Online-only
poor-mans-t-sql-formatter-vscode Poor Man's T-SQL Formatter T-SQL, others No - works offline
vscode-sql-beautify vkbeautify ?? No - works offline
sql-formatter sql-formatter (npm) sql / n1ql / db2 No - works offline
vscode-mssql mssql vscode language service T-SQL, others No - works offline...?
sqltools sql-formatter (npm) sql / n1ql / db2 No - works offline

Custom UIs / Apps

To be thought about later:

Dimensions / properties

To be evaluated:

  • Multi-Statement support
  • Nested Select support
  • CTE support
  • Multi-Batch support
    • T-SQL
    • PL/SQL
    • Others?
  • "Parse Tree" availability
  • Graceful degradation (other dialects, new constructs, etc)
  • DDL Support
    • T-SQL
    • Oracle / PL/SQL
    • PostGre
    • Others?
  • Edge Case support - separately evaluating highlighting correctness, and safety/non-destructiveness in case of issues
    • T-SQL
      • Numerics & Currency
      • Nested Comments
    • Others?
  • General Formatting Styles
    • tab-based indenting, initial clause argument on same line as clause keyword
    • tab-based indenting, initial clause argument on subsequent line to clause keyword
    • tab-based indenting, clauses after first one indented wrt statement start
    • "Aligned" argument/parameter indenting
  • HTML output support
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.