emacs-format-all-the-code icon indicating copy to clipboard operation
emacs-format-all-the-code copied to clipboard

change sql formatter to sql-formatter

Open Tokubara opened this issue 2 years ago • 1 comments

The default sql formatter sqlformat doesn't work. For example:

CREATE TABLE student (
sid INT PRIMARY KEY, name VARCHAR(16), login VARCHAR(32) UNIQUE, age SMALLINT, gpa FLOAT );

format this piece of sql with

sqlformat tmp.sql  --reindent --indent_width 4 --keywords upper --use_space_around_operators

gets:

CREATE TABLE student (sid INT PRIMARY KEY,
                                      name VARCHAR(16),
                                           login VARCHAR(32) UNIQUE,
                                                             age SMALLINT, gpa FLOAT);

Without any options, sqlformat tmp.sql just prints the input.

The comment in the first answer about sqlformat points out the same thing.

While sql-formatter works great without any options. So I change sqlformat support to sql-formatter.

Tokubara avatar Mar 07 '23 10:03 Tokubara

We should keep supporting sqlformat. But I agree it's confusing that it does not do anything without any options.

Please edit the PR so that it:

  • preserves sqlformat
  • adds sql-formatter
  • changes the default from sqlformat to sql-formatter

lassik avatar Mar 08 '23 06:03 lassik