SQLFluff

一个模块化的 SQL 接口和自动格式化器,支持多种方言和模板化的代码。「A modular SQL linter and auto-formatter with support for multiple dialects and templated code.」

Github星跟蹤圖

SQLFluff

The SQL Linter for Humans

PyPi Version
PyPi License
PyPi Python Versions
PyPi Status
PyPi Downloads

codecov
CI Tests
ReadTheDocs
Code style: black

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):

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

Alternatively, you can use the Official SQLFluff Docker Image or 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.

主要指標

概覽
名稱與所有者sqlfluff/sqlfluff
主編程語言Python
編程語言Python (語言數: 5)
平台
許可證MIT License
所有者活动
創建於2018-11-01 23:56:04
推送於2025-06-03 15:52:23
最后一次提交
發布數138
最新版本名稱3.4.0 (發布於 )
第一版名稱0.0.1 (發布於 2018-11-07 23:11:09)
用户参与
星數8.9k
關注者數35
派生數829
提交數6.2k
已啟用問題?
問題數3287
打開的問題數565
拉請求數3421
打開的拉請求數15
關閉的拉請求數203
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?