The sqlfluff utility is a linting tool for SQL files, often used with dbt to enforce SQL code standards.

Getting Started #

Prerequisites #

If you haven't already, follow the initial steps of the Getting Started guide:

  1. Install Meltano
  2. Create your Meltano project

Installation and configuration #

  1. Add the sqlfluff utility to your project using meltano add :

    meltano add utility sqlfluff

Next steps #

  1. Customize the config files to match your team’s style guide.
  2. Run meltano invoke sqlfluff:lint to lint your SQL files.
If you run into any issues, learn how to get help.

Settings #

The utility sqlfluff does not have any settings defined in its metadata. Please considering adding them by making a pull request to the YAML file that defines the settings for this utility.

Commands #

The sqlfluff utility supports the following commands that can be used with meltano invoke :

lint #

  • Equivalent to: sqlfluff lint

Lint SQL in transform models.

How to use #

Run this command using meltano invoke:

meltano invoke sqlfluff:lint [additional arguments...]

fix #

  • Equivalent to: sqlfluff fix

Automatically fix SQL files according to your defined rules.

How to use #

Run this command using meltano invoke:

meltano invoke sqlfluff:fix [additional arguments...]

fix-force #

  • Equivalent to: sqlfluff fix --force

Automatically fix SQL files according to your defined rules (does not ask for confirmation).

How to use #

Run this command using meltano invoke:

meltano invoke sqlfluff:fix-force [additional arguments...]

Looking for help? #

If you're having trouble getting the sqlfluff utility to work, look for an existing issue in its repository, file a new issue, or join the Meltano Slack community and ask for help in the #plugins-general channel.

Found an issue on this page? #

This page is generated from a YAML file that you can contribute changes to. Edit it on GitHub!