From 7712616e73c7b3e0d73b0217ae64473c1630f74d Mon Sep 17 00:00:00 2001 From: viktor-ozherelev <141851314+viktor-ozherelev@users.noreply.github.com> Date: Sat, 31 May 2025 23:50:42 +0300 Subject: [PATCH 1/2] allow using ca_cert parameter --- CHANGELOG.md | 5 +++++ README.md | 1 + dbt/adapters/clickhouse/credentials.py | 2 ++ dbt/adapters/clickhouse/httpclient.py | 1 + dbt/adapters/clickhouse/nativeclient.py | 1 + 5 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c130bd6..b34bb6c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +### Release [x.x.x] + +#### Improvements +* Add Certificate Authority root support for httpclient and nativeclient using `ca_cert` parameter + ### Release [1.9.0], 2025-04-28 #### New Features diff --git a/README.md b/README.md index 6bbffcc7..2c8a8064 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ your_profile_name: secure: [False] # Use TLS (native protocol) or HTTPS (http protocol) client_cert: [null] # Path to a TLS client certificate in .pem format client_cert_key: [null] # Path to the private key for the TLS client certificate + ca_cert: [null] # Path to Certificate Authority root to validate ClickHouse server certificate retries: [1] # Number of times to retry a "retriable" database exception (such as a 503 'Service Unavailable' error) compression: [] # Use gzip compression if truthy (http), or compression type for a native connection connect_timeout: [10] # Timeout in seconds to establish a connection to ClickHouse diff --git a/dbt/adapters/clickhouse/credentials.py b/dbt/adapters/clickhouse/credentials.py index e9cf6496..8317229d 100644 --- a/dbt/adapters/clickhouse/credentials.py +++ b/dbt/adapters/clickhouse/credentials.py @@ -26,6 +26,7 @@ class ClickHouseCredentials(Credentials): verify: bool = True client_cert: Optional[str] = None client_cert_key: Optional[str] = None + ca_cert: Optional[str] = None connect_timeout: int = 10 send_receive_timeout: int = 300 sync_request_timeout: int = 5 @@ -77,6 +78,7 @@ def _connection_keys(self): 'verify', 'client_cert', 'client_cert_key', + 'ca_cert', 'connect_timeout', 'send_receive_timeout', 'sync_request_timeout', diff --git a/dbt/adapters/clickhouse/httpclient.py b/dbt/adapters/clickhouse/httpclient.py index 3f2dbaf9..6b5fc775 100644 --- a/dbt/adapters/clickhouse/httpclient.py +++ b/dbt/adapters/clickhouse/httpclient.py @@ -68,6 +68,7 @@ def _create_client(self, credentials): verify=credentials.verify, client_cert=credentials.client_cert, client_cert_key=credentials.client_cert_key, + ca_cert=credentials.ca_cert, query_limit=0, settings=self._conn_settings, ) diff --git a/dbt/adapters/clickhouse/nativeclient.py b/dbt/adapters/clickhouse/nativeclient.py index dfa4c5bd..f32099b1 100644 --- a/dbt/adapters/clickhouse/nativeclient.py +++ b/dbt/adapters/clickhouse/nativeclient.py @@ -70,6 +70,7 @@ def _create_client(self, credentials: ClickHouseCredentials): verify=credentials.verify, certfile=credentials.client_cert, keyfile=credentials.client_cert_key, + ca_certs=credentials.ca_cert, connect_timeout=credentials.connect_timeout, send_receive_timeout=credentials.send_receive_timeout, sync_request_timeout=credentials.sync_request_timeout, From 73dbcca91fffa3a45d29b397fc913296631dc0ac Mon Sep 17 00:00:00 2001 From: viktor-ozherelev <141851314+viktor-ozherelev@users.noreply.github.com> Date: Tue, 3 Jun 2025 21:48:18 +0300 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b34bb6c3..8f6e1b9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,21 @@ #### Improvements * Add Certificate Authority root support for httpclient and nativeclient using `ca_cert` parameter +### Release [1.9.2], 2025-06-03 + +#### Bugs +* Limit dbt-core version to <1.10.X to avoid compatibility issues ([#453](https://github.com/ClickHouse/dbt-clickhouse/pull/453)) +* README file was broken and fixed in ([#454](https://github.com/ClickHouse/dbt-clickhouse/pull/454)) +* Snapshots were not worked properly on cluster, fixed in ([#455](https://github.com/ClickHouse/dbt-clickhouse/pull/455)) +* when the last line of a model's SQL query is a comment (-- some comment) and the table's contract is enforced, the last parenthesis of the wrapping subquery ends up commented as well. Was fixed in ([#457](https://github.com/ClickHouse/dbt-clickhouse/pull/457)) +* Check for Shared database engine in can_exchange ([#460](https://github.com/ClickHouse/dbt-clickhouse/pull/460)) +* Tests were broken because of docker compose version `2.35` and fixed in ([#468](https://github.com/ClickHouse/dbt-clickhouse/pull/468)) + +### Release [1.9.1], 2025-04-28 + +#### Bugs +* Fix missing database_engine error ([#450](https://github.com/ClickHouse/dbt-clickhouse/pull/450)) + ### Release [1.9.0], 2025-04-28 #### New Features