Thank you for considering contributing to the dbt-ClickHouse adapter! We value your contributions and appreciate your efforts to improve the adapter. This guide will help you get started with the contribution process.
Start by forking the repository on GitHub. This will create a copy of the repository under your own GitHub account.
- Make sure Python is installed locally, please refer to dbt's python compatibility (We recommend using version 3.12+).
- Create a dedicated virtual environment (optional but recommended)
- Install all the development requirements:
pip install -r dev_requirements.txt
- Install the local project as a package - go to the project root folder and run
pip install .
- Verify the package was installed successfully:
the package will be directed to your local project.
pip list || grep dbt-clickhouse
Create a new branch for your feature or bug fix, please make sure to follow
git checkout -b my-new-feature
Make the necessary changes in your branch. Ensure that your code follows the existing style and conventions used in the project. We strongly recommend to stick to this official commit message conventions.
The project tests are located under the test
folder. Please look for the relevant test associated with
your changes, and adjust it. If not such test, please create one.
See Running Tests for more information.
Important: Please make sure the tests are running successfully before pushing your code.
Create a pull request from your forked repository to the main one, include the following:
- In case this is your first contribution, make sure to sign ClickHouse's CLA.
- Link the related issue to your PR.
- Add a sensible description of the feature/issue and detail the use case.
- Make sure to update CHANGELOG.md.
This adapter passes all of dbt basic tests as presented in dbt's official docs.
Use pytest tests
to run tests.
You can customize the test environment via environment variables. We recommend doing so with the pytest pytest-dotenv
plugin combined with root level test.env
configuration file (this file should not be checked into git). The following environment variables are recognized:
- DBT_CH_TEST_HOST - Default=
localhost
- DBT_CH_TEST_USER - your ClickHouse username. Default=
default
- DBT_CH_TEST_PASSWORD - your ClickHouse password. Default=''
- DBT_CH_TEST_PORT - ClickHouse client port. Default=8123 (The default is automatically changed to the correct port if DBT_CH_TEST_USE_DOCKER is enabled)
- DBT_CH_TEST_DB_ENGINE - Database engine used to create schemas. Defaults to '' (server default)
- DBT_CH_TEST_USE_DOCKER - Set to True to run clickhouse-server docker image (see tests/docker-compose.yml). Requires docker-compose. Default=False
- DBT_CH_TEST_CH_VERSION - ClickHouse docker image to use. Defaults to
latest
- DBT_CH_TEST_INCLUDE_S3 - Include S3 tests. Default=False since these are currently dependent on a specific ClickHouse S3 bucket/test dataset
- DBT_CH_TEST_CLUSTER_MODE - Use the profile value
- DBT_CH_TEST_CLUSTER - ClickHouse cluster name, if DBT_CH_TEST_USE_DOCKER set to true, only
test_replica
andtest_shard
is valid (see tests/test_config.xml for cluster settings)