Support for SQLFluff (linter & formatter for SQL and dbt)
complete
F
Félix Tremblay
"SQLFluff is a dialect-flexible and configurable SQL linter. Designed with ELT applications in mind, SQLFluff also works with Jinja templating and dbt. SQLFluff will auto-fix most linting errors, allowing you to focus your time on what matters."
SQLFluff supports the following SQL dialects:
ANSI SQL
Athena
BigQuery
ClickHouse
Databricks
Db2
Exasol
Hive
MySQL
Oracle
PostgreSQL (aka Postgres)
Redshift
Snowflake
SOQL
SparkSQL
SQLite
Teradata
Transact-SQL (aka T-SQL)
Sam Lijin
complete
Added support for this back in October: https://github.com/trunk-io/plugins/pull/36
Eli Schleifer
Good news!
sqlfluff is one of the first linters we've integrated in the new trunk-io/plugins repository.
To enable sqlfluff make sure you've upgrade to latest trunk (v0.17.0) and pin the plugins repo to v0.0.4
plugins:
sources:
- id: trunk
ref: v0.0.4
Then you can run
trunk check enable sqlfluff
Sam Lijin
We do actually support sqlfluff! If you run
trunk check enable sqlfluff
it should get turned on for you :)Please let us know if you have any feedback about how it works for you - we added support for it somewhat recently, and there may be some quirks around its dialect detection.
F
Felix Tremblay
Sam Lijin: Eli Schleifer: a big issue is that it does not format since it's only configured as a linter (see https://docs.trunk.io/docs/check-supported-linters#sqlfluff)
As far as I know, sql-formatter is NOT a formatter that dbt / jinja-sql users can use.
(A formatter that works great is https://github.com/tconbeer/sqlfmt)
Is there a way to configure sqlfluff as a formatter?