Skip to main content

Modular SQL Linting for Humans

Project description

SqlFluff :scroll: :black_nib: :sparkles:

The SQL Linter for humans

image image image codecov CircleCI

Bored of not having a good SQL linter that works with whichever dialiect you're working with? Fluff is an extensible and modular linter designed to help you write good SQL and catch errors and bad SQL before it hits your database.

Getting Started

To get started just install the package, make a sql file and then run sqlfluff and point it at the file.

$ 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

Usage

For more details on usage see the docs on github here.

Progress

There's lots to do in this project, and we're just getting started.

  • Command line interface
    • Basic linting, both of paths and files
    • Version information
    • Nicely formatted readout of linting success or fail
    • Exist codes which reflect linting success or fail
    • Filtering to particular codes in the linting step
    • Allow basic correction of some linting codes
  • Basic ANSI linting
    • Simple whitespace testing
    • Whitespace around operators
    • Indentation (size and mix of tabs and spaces)
    • Indentation between lines and when to indent
    • Number of blank lines
    • Indentation of comments
  • Configurable linting
    • Command line options for config
    • Ability to read from config files
    • Ignore particular rules
    • Specifying particlar dialects to use
    • Preconfiguring verbosity
  • Dialects
    • MySQL
    • Redshift
    • Detecting dialect from a config file of some kind

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.0.6] - 2018-11-15

Added

  • Number matching

Changed

  • Fixed operator parsing and linting (including allowing the exception of (*))

[0.0.5] - 2018-11-15

Added

  • Much better documentation including the DOCS.md

Changed

  • Fixed comma parsing and linting

[0.0.4] - 2018-11-14

Added

  • Added operator regexes
  • Added a priority for matchers to resolve some abiguity
  • Added tests for operator regexes
  • Added ability to initialise the memory in rules

[0.0.3] - 2018-11-14

Added

  • Refactor of rules to allow rules with memory
  • Adding comma linting rules (correcting the single character matchers)
  • Adding mixed indentation linting rules
  • Integration with CircleCI, CodeCov and lots of badges

Changed

  • Changed import of version information to fix bug with importing config.ini
  • Added basic violations/file reporting for some verbosities
  • Refactor of rules to simplify definition
  • Refactor of color cli output to make it more reusable

[0.0.2] - 2018-11-09

Added

  • Longer project description
  • Proper exit codes
  • colorama for colored output

Changed

  • Significant CLI changes
  • Much improved output from CLI

[0.0.1] - 2018-11-07

Added

  • Initial Commit! - VERY ALPHA
  • Restructure into package layout
  • Adding Tox and Pytest so that they work

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

sqlfluff-0.0.7.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlfluff-0.0.7-py3.6.egg (47.6 kB view details)

Uploaded Egg

File details

Details for the file sqlfluff-0.0.7.tar.gz.

File metadata

  • Download URL: sqlfluff-0.0.7.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for sqlfluff-0.0.7.tar.gz
Algorithm Hash digest
SHA256 591ff3cb5cd18404aa4833b0af88cf6d08cddf8b7223b78e43a45cfa58dd48d4
MD5 d7c334d862cd692f821e15c16a8da88b
BLAKE2b-256 3f901fd22c097b764705ff5f9f3f7ad86de7befdf307492edbec040734da7dec

See more details on using hashes here.

File details

Details for the file sqlfluff-0.0.7-py3.6.egg.

File metadata

  • Download URL: sqlfluff-0.0.7-py3.6.egg
  • Upload date:
  • Size: 47.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for sqlfluff-0.0.7-py3.6.egg
Algorithm Hash digest
SHA256 69af0b40a0767a5dcb0eb1e623fd72f30523e96499de49dbfb7e172fab12bcf1
MD5 1a0187462564a1bad32d5df08635cdd7
BLAKE2b-256 71454956217ffb3e52fdd6f11b78097d675001c5969df8ef359b0f77c646d3ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page