Try it out in the playground! Dialects SupportedSqruff currently supports the following SQL dialects:
While those above are the supported dialects, we are working on adding support for more dialects in the future. Getting StartedTry it in your browserOpen the playground to try out the linter and formatter online. InstallationmacOSYou can use brew to install sqruff easily on macOS.
LinuxUsing
PipYou can also install sqruff using pip.
GitHub ActionYou can also use the GitHub Action to install and run sqruff in your CI/CD pipeline. Inside a Github Action,
For other platformsEither download the binary from the releases page or compile it yourself and with cargo with the following commands.
Visual Studio Code ExtensionIn addition to the CLI installation mechanism listed above, sqruff is also released as a Visual Studio Code extension. UsageLintingTo lint a SQL file or set of files, run the following command:
FixingTo fix a single or set of files, run the following command:
ConfigurationSettings for SQL dialect, indentation, capitalization, and other linting/style options are configured in a The following example highlights a few configuration points: setting the dialect to
Ignoring errorsThe NoQA directive is a way to disable specific rules or all rules for a specific line or range of lines. Similar to flake8’s ignore, individual lines can be ignored by adding Ignoring single line errorsThe following example will ignore all errors on the line where it is placed:
Ignoring multiple line errorsSimilar to pylint’s “pylint directive”, ranges of lines can be ignored by adding For example:
HelpTo get help on the available commands and options, run the following command:
For all the details on the CLI commands and options, see the CLI documentation. DocsFor more details about, see the documents in the docs folder which contains: CommunityJoin the Quary community on Slack to ask questions, suggest features, or share your projects. Also feel free to raise any issues in the repository. ContributingContributions are welcome! See CONTRIBUTING.md for guidelines on how to run things locally and on how to contribute. CreditsThe sqruff project wouldn't be possible without "heavy inspiration" from the sqlfluff and ruff projects! We're very grateful to their awesome work! |