Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sqlfluff as an alternative formatter #117

Open
musjj opened this issue Oct 18, 2024 · 1 comment
Open

Support sqlfluff as an alternative formatter #117

musjj opened this issue Oct 18, 2024 · 1 comment

Comments

@musjj
Copy link

musjj commented Oct 18, 2024

https://github.com/sqlfluff/sqlfluff

In general sqlfluff is just a nicer and more well-mantained formatter that handles edge cases more robustly IMO. Faced a few cases where sql-formatter is just not doing things consistently, for example:

$ echo "CREATE TABLE foobar ( ids UUID[] );" | sql-formatter
CREATE TABLE foobar (ids UUID []);

$ echo "CREATE TABLE foobar ( ids TEXT[] );" | sql-formatter
CREATE TABLE foobar (ids TEXT[]);

In sqlfluff, they're always consistent. The CLI tool is also more CI-friendly as it can print diagnostics if there are any non-conformant sql files:

$ sqlfluff lint test.sql --dialect ansi
== [test.sql] FAIL
L:   1 | P:   1 | LT01 | Expected only single space before 'SELECT' keyword.
                       | Found '  '. [layout.spacing]

sqlfluff can also be configured a lot more flexibly: https://docs.sqlfluff.com/en/stable/reference/rules.html

@senkenn
Copy link
Owner

senkenn commented Oct 19, 2024

I am not having trouble with sql-formatter right now. So I don't plan to support sqlfluff anytime soon. I will consider supporting it as more requests come in.
If we do decide to support more than one formatter, I will allow users to pass format commands, and allow them to use the formatter of their choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants