Thank you for your interest in contributing to the dbt Artifacts Package! We welcome contributions of all kinds, including bug reports, feature requests, and pull requests. Please read this document to learn how to contribute.
If you find a bug, please open an issue and describe the problem. If possible, include a minimal example that maintainers can use to reproduce the issue. If you are able to fix the bug, please open a pull request with a fix.
If you would like to request a new feature, please open an issue and describe the desired behavior. If you are able to implement the feature, please open a pull request with your changes. If you need help with either of these steps, please let us know!
The high-level flow for contributing code to the dbt Artifacts Package is as follows (see below for details of each stage):
- Fork the dbt Artifacts Package repository
- Clone your fork locally
- Create a new branch
- Make your changes
- Run the tests
- Open a pull request against the
main
branch - Make sure your pull request passes all checks
- Address any review feedback
- Merge your pull request
The first step to contributing code is to fork the dbt Artifacts Package repository. Once you have a fork, you can clone it locally and begin making changes.
To run the tests, we use tox. Tox is a tool that automates testing in multiple Python environments. Tox is a CLI tool that needs a Python interpreter (version 3.7 or higher) to run. We recommend pipx to install tox into an isolated environment. This has the added benefit that later you’ll be able to upgrade tox without affecting other parts of the system.
Tox will take care of installing the dependencies for each environment, so you don’t need to worry about that.
-
Install pipx
pip install pipx pipx ensurepath
-
Install tox
pipx install tox
-
Copy and paste the
integration_test_project/example-env.sh
file and save asenv.sh
. Fill in the missing values. If you want to run only tests for a specific database, you can leave the other values blank.cp integration_test_project/example-env.sh env.sh vim env.sh
-
Source the file in your current shell context with the command:
. ./env.sh
-
From the root directory, run the tests for the databases you have access to below:
tox -e integration_snowflake # For the Snowflake tests tox -e integration_databricks # For the Databricks tests tox -e integration_bigquery # For the BigQuery tests
The Spark tests require installing the ODBC driver. On a Mac,
DBT_ENV_SPARK_DRIVER_PATH should be set to /Library/simba/spark/lib/libsparkodbc_sbu.dylib
. Spark tests have not yet
been added to the integration tests.
If you don't have access to a particular database type, this isn't a problem. Test on the one you do have, and let us know in the PR.
We use SQLFluff to keep SQL style consistent. A GitHub action automatically tests pull requests and adds annotations
where there are failures. SQLFluff can also be run locally with tox
.
Lint all models in the /models directory:
tox
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.