Skip to main content

A pytest plugin to use sqlfluff to enable format checking of sql files.

Project description

PyPI version Python versions See Build Status on Github Workflows Code Style: Black

A pytest plugin to use sqlfluff to enable format checking of sql files.


  • Tests any sql files found in project.

  • Leverages existing sqlfluff configurations.

  • Skips unchanged sql files.



You can install pytest-sqlfluff via pip from PyPI:

$ pip install pytest-sqlfluff


Out of the box, you can run pytest-sqlfluff as argument to pytest:

$ pytest --sqlfluff
====================================== test session starts ======================================
platform darwin -- Python 3.9.6, pytest-7.2.0, pluggy-1.0.0
rootdir: /code/
plugins: sqlfluff-0.1.0
collected 1 item

tests/file.sql .                                                                          [100%]

======================================= 1 passed in 0.45s =======================================

To configure your sqlfluff linting, use the standard sqlfluff configuration mechanisms. At the very least, you’ll likely need to set the dialect.:

dialect = postgres


Contributions are very welcome. Tests can be run with pytest, please ensure the coverage at least stays the same before you submit a pull request.

To get started:

$ git clone
$ cd pytest-sqlfluff
$ poetry install

Run tests:

$ poetry run pytest


Distributed under the terms of the MIT license, “pytest-sqlfluff” is free and open source software


If you encounter any problems, please file an issue along with a detailed description.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_sqlfluff-0.1.1.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

pytest_sqlfluff-0.1.1-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page