SQLFluff plugin for SQL and dbt model complexity rules
Project description
sqlfluff-complexity
SQLFluff rules and reports for finding SQL and dbt models that are too complex to review safely.
sqlfluff-complexity adds CPX rules to SQLFluff for CTE count, join count, nested
subquery depth, CASE expressions, boolean predicates, window functions, and an
aggregate weighted complexity score. The same metric engine also powers a companion
sqlfluff-complexity report command for non-blocking console and SARIF reports.
Who It Is For
- Analytics engineers who want dbt models to stay small enough to review.
- Data platform teams that already run SQLFluff in local development or CI.
- Teams that want gradual complexity reporting before turning on strict lint failures.
Quick Start
Install the custom SQLFluff plugin in the same Python environment where you run SQLFluff:
pip install sqlfluff-complexity
If your project uses uv:
uv add --dev sqlfluff-complexity
Then enable CPX rules in .sqlfluff and run SQLFluff:
[sqlfluff]
dialect = postgres
rules = CPX_C101,CPX_C102,CPX_C103,CPX_C104,CPX_C105,CPX_C106,CPX_C201
sqlfluff lint models/
For a complete walkthrough, see docs/quickstart.md.
Documentation
- Quick start: install, configure, and run the first lint.
- Configuration: thresholds, aggregate weights, and path overrides.
- Rules reference: CPX rule codes and what each metric counts.
- Reporting: console and SARIF report mode.
- dbt usage: SQLFluff dbt templater compatibility and v1 boundaries.
- Dialects: tested dialects and dbt adapter mapping caveats.
- Docs index: all user, contributor, and design documents.
Project Status
- Native SQLFluff plugin rules and the companion report CLI are available in the package.
- v1 measures SQLFluff-parsed SQL; direct dbt
manifest.jsonand DAG-level metrics are deferred. - Architecture decisions are recorded in docs/adr/.
Development
Contributor setup, Nox sessions, fixture authoring, ADR workflow, and verifier guidance live in CONTRIBUTING.md. Agent-specific project instructions live in AGENTS.md.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlfluff_complexity-0.1.0.tar.gz.
File metadata
- Download URL: sqlfluff_complexity-0.1.0.tar.gz
- Upload date:
- Size: 3.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67f42ba207293bdaa1363e0c2a5b225bc4be774b812838a7785a95aa79cfb39e
|
|
| MD5 |
835e9834e06c5043de1802fa6d6412c3
|
|
| BLAKE2b-256 |
5823cfa7e7bf6c5659886be144bb598c618d3c4126ef246e957c8be3cb654426
|
Provenance
The following attestation bundles were made for sqlfluff_complexity-0.1.0.tar.gz:
Publisher:
publish.yml on yu-iskw/sqlfluff-complexity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlfluff_complexity-0.1.0.tar.gz -
Subject digest:
67f42ba207293bdaa1363e0c2a5b225bc4be774b812838a7785a95aa79cfb39e - Sigstore transparency entry: 1418047747
- Sigstore integration time:
-
Permalink:
yu-iskw/sqlfluff-complexity@d121f280072db7f529ec5d291c70c2c3598f70ed -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/yu-iskw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d121f280072db7f529ec5d291c70c2c3598f70ed -
Trigger Event:
release
-
Statement type:
File details
Details for the file sqlfluff_complexity-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sqlfluff_complexity-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
490e324e4ecaeb216aaed73653626d59add0e6b3023903b2d2d6159a61024919
|
|
| MD5 |
7b0e47e57a0269c623edcf0f490ea9fb
|
|
| BLAKE2b-256 |
cc4ef94776c4a237774b79a7715e9c947ab547b19aa8787e445bb95f257adde5
|
Provenance
The following attestation bundles were made for sqlfluff_complexity-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on yu-iskw/sqlfluff-complexity
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlfluff_complexity-0.1.0-py3-none-any.whl -
Subject digest:
490e324e4ecaeb216aaed73653626d59add0e6b3023903b2d2d6159a61024919 - Sigstore transparency entry: 1418047753
- Sigstore integration time:
-
Permalink:
yu-iskw/sqlfluff-complexity@d121f280072db7f529ec5d291c70c2c3598f70ed -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/yu-iskw
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d121f280072db7f529ec5d291c70c2c3598f70ed -
Trigger Event:
release
-
Statement type: