The SQL Linter for Humans
Project description
The SQL Linter for Humans
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.
Dialects Supported
Although SQL is reasonably consistent in its implementations, there are several different dialects available with variations of syntax and grammar. SQLFluff currently supports the following SQL dialects (though perhaps not in full):
- ANSI SQL - this is the base version and on occasion may not strictly follow the ANSI/ISO SQL definition
- BigQuery
- Exasol
- Hive
- MySQL
- PostgreSQL (aka Postgres)
- Redshift
- Snowflake
- Spark3
- SQLite
- Teradata
- Transact-SQL (aka T-SQL)
We aim to make it easy to expand on the support of these dialects and also add other, currently unsupported, dialects. Please raise issues (or upvote any existing issues) to let us know of demand for missing support.
Pull requests from those that know the missing syntax or dialects are especially welcomed and are the question way for you to get support added. We are happy to work with any potential contributors on this to help them add this support. Please raise an issue first for any large feature change to ensure it is a good fit for this project before spending time on this work.
Templates Supported
SQL itself does not lend itself well to modularity, so to introduce some flexibility and reusability it is often templated as discussed more in our modularity documentation.
SQLFluff supports the following templates:
Again, please raise issues if you wish to support more templating languages/syntaxes.
Getting Started
To get started, install the package and run sqlfluff lint
or sqlfluff fix
.
$ pip install sqlfluff
$ echo " SELECT a + b FROM tbl; " > test.sql
$ sqlfluff lint test.sql
== [test.sql] FAIL
L: 1 | P: 1 | L003 | Single indentation uses a number of spaces not a multiple of 4
L: 1 | P: 14 | L006 | Operators should be surrounded by a single space unless at the start/end of a line
L: 1 | P: 27 | L001 | Unnecessary trailing whitespace
You can also have a play using SQLFluff online.
For full CLI usage and rules reference, see the SQLFluff docs.
Documentation
For full documentation visit docs.sqlfluff.com. This documentation is generated from this repository so please raise issues or pull requests for any additions, corrections, or clarifications.
Releases
SQLFluff is in beta phase - expect the tool to change significantly with potentially non-backwards compatible API and configuration changes in future releases. If you would like to join in please consider contributing.
New releases are made monthly. For more information, visit Releases.
SQLFluff on Slack
We have a fast-growing community on Slack, come and join us!
SQLFluff on Twitter
Follow us on Twitter @SQLFluff for announcements and other related posts.
Contributing
We are grateful to all our contributors. There is a lot to do in this project, and we are just getting started.
If you want to understand more about the architecture of SQLFluff, you can find more here.
If you would like to contribute, check out the open issues on GitHub. You can also see the guide to contributing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sqlfluff-0.8.2.tar.gz
.
File metadata
- Download URL: sqlfluff-0.8.2.tar.gz
- Upload date:
- Size: 345.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e48db0e1f7775c4609aa843cc8fa7fbc4a42d38fef640a78cc33d335ad385c62 |
|
MD5 | 26154653d38e6ce2e11714ee5afe3f7a |
|
BLAKE2b-256 | 3b1b1b6a4b9e35e2884651f94ccc31f96a8cb5fde57c2c531767b12d561c8377 |
File details
Details for the file sqlfluff-0.8.2-py3-none-any.whl
.
File metadata
- Download URL: sqlfluff-0.8.2-py3-none-any.whl
- Upload date:
- Size: 396.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d63f1fb9ee65c965ba11ddeefa7a433feb276d323a7f58802e43fbb0d17fd67 |
|
MD5 | f5f77a36c2aeec9e3676514d7a318a2d |
|
BLAKE2b-256 | be34851d13fbd14833fcefa7150118cec6cd3573c1d16145f09ac286ded99de2 |