From aeda00e4f7a2bd0697226f8481552d6d8ec868e6 Mon Sep 17 00:00:00 2001 From: Damian Owsianny Date: Wed, 11 Dec 2024 19:47:03 +0100 Subject: [PATCH 1/2] Revert "Bumping version to 1.8.5 and generate CHANGELOG" This reverts commit ca8639206916e1bfb552c37f8f3932461ba5bad2. --- .changes/1.8.5.md | 7 ------- .changes/{1.8.5 => unreleased}/Fixes-20241126-125237.yaml | 0 .changes/{1.8.5 => unreleased}/Fixes-20241206-132238.yaml | 0 CHANGELOG.md | 7 ------- dbt/adapters/trino/__version__.py | 2 +- 5 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 .changes/1.8.5.md rename .changes/{1.8.5 => unreleased}/Fixes-20241126-125237.yaml (100%) rename .changes/{1.8.5 => unreleased}/Fixes-20241206-132238.yaml (100%) diff --git a/.changes/1.8.5.md b/.changes/1.8.5.md deleted file mode 100644 index 591da2c4..00000000 --- a/.changes/1.8.5.md +++ /dev/null @@ -1,7 +0,0 @@ -## dbt-trino 1.8.5 - December 10, 2024 -### Fixes -- Fix breaking compatibility with Python 3.8 ([#452](https://github.com/starburstdata/dbt-trino/pull/452)) -- Fix so that file_format and table_format config values do not require wrapping in single quotes ([#454](https://github.com/starburstdata/dbt-trino/issues/454), [#455](https://github.com/starburstdata/dbt-trino/pull/455)) - -### Contributors -- [@damian3031](https://github.com/damian3031) ([#452](https://github.com/starburstdata/dbt-trino/pull/452), [#455](https://github.com/starburstdata/dbt-trino/pull/455)) diff --git a/.changes/1.8.5/Fixes-20241126-125237.yaml b/.changes/unreleased/Fixes-20241126-125237.yaml similarity index 100% rename from .changes/1.8.5/Fixes-20241126-125237.yaml rename to .changes/unreleased/Fixes-20241126-125237.yaml diff --git a/.changes/1.8.5/Fixes-20241206-132238.yaml b/.changes/unreleased/Fixes-20241206-132238.yaml similarity index 100% rename from .changes/1.8.5/Fixes-20241206-132238.yaml rename to .changes/unreleased/Fixes-20241206-132238.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 698875eb..6bf2b616 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,6 @@ - Changes are listed under the (pre)release in which they first appear. Subsequent releases include changes from previous releases. - "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version. - Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/starburstdata/dbt-trino/blob/master/CONTRIBUTING.md#adding-changelog-entry) -## dbt-trino 1.8.5 - December 10, 2024 -### Fixes -- Fix breaking compatibility with Python 3.8 ([#452](https://github.com/starburstdata/dbt-trino/pull/452)) -- Fix so that file_format and table_format config values do not require wrapping in single quotes ([#454](https://github.com/starburstdata/dbt-trino/issues/454), [#455](https://github.com/starburstdata/dbt-trino/pull/455)) - -### Contributors -- [@damian3031](https://github.com/damian3031) ([#452](https://github.com/starburstdata/dbt-trino/pull/452), [#455](https://github.com/starburstdata/dbt-trino/pull/455)) ## dbt-trino 1.8.4 - November 22, 2024 ### Under the Hood - Revert cert default to False. Add require_certificate_validation Behavior Flag ([#447](https://github.com/starburstdata/dbt-trino/pull/447)) diff --git a/dbt/adapters/trino/__version__.py b/dbt/adapters/trino/__version__.py index cb9f5164..f2493fc9 100644 --- a/dbt/adapters/trino/__version__.py +++ b/dbt/adapters/trino/__version__.py @@ -1 +1 @@ -version = "1.8.5" +version = "1.8.4" From 868bf76dfbc2dda6b1b499ca82393694cbbd762c Mon Sep 17 00:00:00 2001 From: Damian Owsianny Date: Wed, 11 Dec 2024 19:55:30 +0100 Subject: [PATCH 2/2] Allow boolean values in the cert parameter --- .changes/unreleased/Fixes-20241211-202907.yaml | 7 +++++++ dbt/adapters/trino/connections.py | 16 ++++++++-------- tests/unit/test_adapter.py | 8 ++++---- 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 .changes/unreleased/Fixes-20241211-202907.yaml diff --git a/.changes/unreleased/Fixes-20241211-202907.yaml b/.changes/unreleased/Fixes-20241211-202907.yaml new file mode 100644 index 00000000..3a3ab3b8 --- /dev/null +++ b/.changes/unreleased/Fixes-20241211-202907.yaml @@ -0,0 +1,7 @@ +kind: Fixes +body: Allow boolean values in the cert parameter +time: 2024-12-11T20:29:07.954737+01:00 +custom: + Author: damian3031 + Issue: "" + PR: "460" diff --git a/dbt/adapters/trino/connections.py b/dbt/adapters/trino/connections.py index f76bd055..86d7eeec 100644 --- a/dbt/adapters/trino/connections.py +++ b/dbt/adapters/trino/connections.py @@ -6,7 +6,7 @@ from dataclasses import dataclass, field from datetime import date, datetime from enum import Enum -from typing import Any, Dict, List, Optional +from typing import Any, Dict, List, Optional, Union import sqlparse import trino @@ -99,7 +99,7 @@ class TrinoNoneCredentials(TrinoCredentials): user: str client_tags: Optional[List[str]] = None roles: Optional[Dict[str, str]] = None - cert: Optional[str] = None + cert: Optional[Union[str, bool]] = None http_scheme: HttpScheme = HttpScheme.HTTP http_headers: Optional[Dict[str, str]] = None session_properties: Dict[str, Any] = field(default_factory=dict) @@ -124,7 +124,7 @@ class TrinoCertificateCredentials(TrinoCredentials): user: Optional[str] = None client_tags: Optional[List[str]] = None roles: Optional[Dict[str, str]] = None - cert: Optional[str] = None + cert: Optional[Union[str, bool]] = None http_headers: Optional[Dict[str, str]] = None session_properties: Dict[str, Any] = field(default_factory=dict) prepared_statements_enabled: bool = PREPARED_STATEMENTS_ENABLED_DEFAULT @@ -154,7 +154,7 @@ class TrinoLdapCredentials(TrinoCredentials): impersonation_user: Optional[str] = None client_tags: Optional[List[str]] = None roles: Optional[Dict[str, str]] = None - cert: Optional[str] = None + cert: Optional[Union[str, bool]] = None http_headers: Optional[Dict[str, str]] = None session_properties: Dict[str, Any] = field(default_factory=dict) prepared_statements_enabled: bool = PREPARED_STATEMENTS_ENABLED_DEFAULT @@ -185,7 +185,7 @@ class TrinoKerberosCredentials(TrinoCredentials): krb5_config: Optional[str] = None service_name: Optional[str] = "trino" mutual_authentication: Optional[bool] = False - cert: Optional[str] = None + cert: Optional[Union[str, bool]] = None http_headers: Optional[Dict[str, str]] = None force_preemptive: Optional[bool] = False hostname_override: Optional[str] = None @@ -227,7 +227,7 @@ class TrinoJwtCredentials(TrinoCredentials): user: Optional[str] = None client_tags: Optional[List[str]] = None roles: Optional[Dict[str, str]] = None - cert: Optional[str] = None + cert: Optional[Union[str, bool]] = None http_headers: Optional[Dict[str, str]] = None session_properties: Dict[str, Any] = field(default_factory=dict) prepared_statements_enabled: bool = PREPARED_STATEMENTS_ENABLED_DEFAULT @@ -253,7 +253,7 @@ class TrinoOauthCredentials(TrinoCredentials): user: Optional[str] = None client_tags: Optional[List[str]] = None roles: Optional[Dict[str, str]] = None - cert: Optional[str] = None + cert: Optional[Union[str, bool]] = None http_headers: Optional[Dict[str, str]] = None session_properties: Dict[str, Any] = field(default_factory=dict) prepared_statements_enabled: bool = PREPARED_STATEMENTS_ENABLED_DEFAULT @@ -282,7 +282,7 @@ class TrinoOauthConsoleCredentials(TrinoCredentials): user: Optional[str] = None client_tags: Optional[List[str]] = None roles: Optional[Dict[str, str]] = None - cert: Optional[str] = None + cert: Optional[Union[str, bool]] = None http_headers: Optional[Dict[str, str]] = None session_properties: Dict[str, Any] = field(default_factory=dict) prepared_statements_enabled: bool = PREPARED_STATEMENTS_ENABLED_DEFAULT diff --git a/tests/unit/test_adapter.py b/tests/unit/test_adapter.py index d3f2de58..40c5578a 100644 --- a/tests/unit/test_adapter.py +++ b/tests/unit/test_adapter.py @@ -229,7 +229,7 @@ def test_none_authentication_without_http_scheme(self): "method": "none", "schema": "dbt_test_schema", "user": "trino_user", - "cert": "/path/to/cert", + "cert": True, "client_tags": ["dev", "without_http_scheme"], "http_headers": {"X-Trino-Client-Info": "dbt-trino"}, "session_properties": { @@ -243,7 +243,7 @@ def test_none_authentication_without_http_scheme(self): self.assert_default_connection_credentials(credentials) self.assertIsInstance(credentials, TrinoNoneCredentials) self.assertEqual(credentials.http_scheme, HttpScheme.HTTP) - self.assertEqual(credentials.cert, "/path/to/cert") + self.assertEqual(credentials.cert, True) self.assertEqual(credentials.client_tags, ["dev", "without_http_scheme"]) self.assertEqual(credentials.timezone, "UTC") @@ -261,7 +261,7 @@ def test_ldap_authentication(self): "user": "trino_user", "impersonation_user": "impersonated_user" if is_impersonation else None, "password": "trino_password", - "cert": "/path/to/cert", + "cert": False, "client_tags": ["dev", "ldap"], "http_headers": {"X-Trino-Client-Info": "dbt-trino"}, "session_properties": { @@ -276,7 +276,7 @@ def test_ldap_authentication(self): self.assertIsInstance(credentials, TrinoLdapCredentials) self.assert_default_connection_credentials(credentials) self.assertEqual(credentials.http_scheme, HttpScheme.HTTPS) - self.assertEqual(credentials.cert, "/path/to/cert") + self.assertEqual(credentials.cert, False) self.assertEqual(connection.handle.handle.user, expected_user) self.assertEqual(credentials.client_tags, ["dev", "ldap"]) self.assertEqual(credentials.timezone, "UTC")