Last updated:
0 purchases
pytestsqlfluff 0.1.1
A pytest plugin to use sqlfluff to enable format checking of sql files.
Features
Tests any sql files found in project.
Leverages existing sqlfluff configurations.
Skips unchanged sql files.
Requirements
Python 3.7+
sqlfluff 1.0.0+
Installation
You can install pytest-sqlfluff via pip from PyPI:
$ pip install pytest-sqlfluff
Usage
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/github.com/prsutherland/pytest-sqlfluff
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.:
[sqlfluff]
dialect = postgres
...
Contributing
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 https://github.com/prsutherland/pytest-sqlfluff.git
$ cd pytest-sqlfluff
$ poetry install
Run tests:
$ poetry run pytest
License
Distributed under the terms of the MIT license, “pytest-sqlfluff” is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.