Skip to content

Configuring sqlfluff

sqlfluff is a feature rich SQL formatter that's written in Python and hence is an external dependency for tapestry.

sqlfluff recognizes a file named ./.sqlfluff a standard configuration file to load config from. Tapestry capitalizes on this so that there's no need to invent a new config format.

The configuration options for sqlfluff are quite extensive and well documented - https://docs.sqlfluff.com/en/stable/configuration/index.html.

During project initialization, if sqlfluff is found installed on your system (and in $PATH), it will be shown as one of the formatter options. Upon choosing it, following lines will be added to the tapestry.toml manifest file.

[formatter.sqlfluff]
# (required) Location of the sqlfluff executable
exec_path = "sqlfluff"

Additionally, it will also create the .sqlfluff config file alongside the manifest file.

[sqlfluff]
dialect = postgres

You may refer to sqlfluff documentation to configure formatting as per your preferences.

Note

Unlike in pgFormatter's config, the path to the sqlfluff config file doesn't need to be explicitly specified in the manifest file. Similar to normal functioning of sqlfluff, config will be implicitly loaded from a file named ./.sqlfluff in the current directory. Since tapestry commands are run from the same dir that this file is created in, it just works.