| name | sql-lint |
|---|---|
| description | SQL code style check - Use SQLFluff to check SQL statement style and syntax (supports PostgreSQL, MySQL, SQLite, etc.) |
Use SQLFluff to check SQL code quality, supporting multiple database dialects:
- PostgreSQL, MySQL, MariaDB
- SQLite, BigQuery, Snowflake
- Redshift, TSQL, Oracle, etc.
| Tool | Installation |
|---|---|
| Python 3.8+ | python.org |
| SQLFluff | pip install sqlfluff |
Check single file:
.\.agent\skills\sql-lint\scripts\lint.ps1 -File query.sqlSpecify database dialect:
.\.agent\skills\sql-lint\scripts\lint.ps1 -Dialect postgresAuto-fix:
.\.agent\skills\sql-lint\scripts\lint.ps1 -Fix- β SQL keyword case consistency
- β Indentation and formatting standards
- β JOIN type clarity
- β Table alias usage standards
- β WHERE condition safety
| Dialect | Database |
|---|---|
postgres |
PostgreSQL |
mysql |
MySQL/MariaDB |
sqlite |
SQLite |
bigquery |
Google BigQuery |
snowflake |
Snowflake |
tsql |
SQL Server |
Create .sqlfluff:
[sqlfluff]
dialect = postgres
templater = jinja
exclude_rules = L003,L009
[sqlfluff:indentation]
indent_unit = space
tab_space_size = 2
[sqlfluff:rules:L010]
capitalisation_policy = upper