Git Product home page Git Product logo

sqlfluff's Introduction

SqlFluff ๐Ÿ“œ โœ’๏ธ โœจ

The SQL Linter for humans

image image image codecov Requirements Status 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.

Sqlfluff is still in an open alpha phase - expect the tool to change significantly over the coming months, and expect potentially non-backward compatable api changes to happen at any point.

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

sqlfluff's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.