Skip to main content
Version: 2.22

SQL Overview


SQL support is in alpha stage

Pants is currently building support for SQL. Simple use cases might be supported, but many options are missing.

Please share feedback for what you need to use Pants with your SQL queries by either opening a GitHub issue or joining our Slack!

Initial setup

First, activate the relevant backend in pants.toml:

pants.toml
[GLOBAL]
backend_packages = [
...
"pants.backend.experimental.sql",
...
]

The SQL backend adds sql_source and sql_sources target types for SQL files. The sql_source behaves like resource, so you can use it directly without wrappers. The tailor goal will automatically generate the targets for your .sql files.

Enable sqlfluff linter

To enable the linter activate the relevant backend in pants.toml:

pants.toml
[GLOBAL]
backend_packages = [
...
"pants.backend.experimental.sql.lint.sqlfluff",
...
]

You can run the linter via lint goal:

pants lint --only=sqlfluff ::