You're free to use the environment management tools you prefer but if you're familiar with those, you can use the following:
- pipx (to isolate the global tools from your local environment)
- tox (to run the tests)
- pre-commit (to run the linter)
- SQLFluff (to lint SQL)
- changie (to generate CHANGELOG entries)
To install pipx:
pip install pipx
pipx ensurepath
Then you'll be able to install tox, pre-commit and sqlfluff with pipx:
pipx install tox
pipx install pre-commit
pipx install sqlfluff
To install changie, there are few options depending on your OS. See the installation guide for more details.
To configure pre-commit hooks:
pre-commit install
To configure your dbt profile, run following command and follow the prompts:
dbt init
- Fork the repo
- Create a branch from
main
- Make your changes
- Run
tox
to run the tests - Create your changelog entry with
changie new
(don't edit directly the CHANGELOG.md) - Commit your changes (it will run the linter through pre-commit)
- Push your branch and open a PR on the repository
We use changie to generate CHANGELOG entries. Note: Do not edit the CHANGELOG.md directly. Your modifications will be lost.
Follow the steps to install changie for your system.
Once changie is installed and your PR is created, simply run changie new
and changie will walk you through the process of creating a changelog entry. Commit the file that's created and your changelog entry is complete!
We use SQLFluff to keep SQL style consistent. By installing pre-commit
per the initial setup guide above, SQLFluff will run automatically when you make a commit locally. A GitHub action automatically tests pull requests and adds annotations where there are failures.
Lint all models in the /models directory:
tox -e lint_all
Fix all models in the /models directory:
tox -e fix_all
Lint (or subsitute lint to fix) a specific model:
tox -e lint -- models/path/to/model.sql
Lint (or subsitute lint to fix) a specific directory:
tox -e lint -- models/path/to/directory
Enforced rules are defined within tox.ini
. To view the full list of available rules and their configuration, see the SQLFluff documentation.