From b4a2f94c1601bb762a8be8a44085d23b3188b3cb Mon Sep 17 00:00:00 2001 From: tim-steinkuhler Date: Mon, 26 Jun 2023 19:56:05 +0200 Subject: [PATCH] Allow hostname to be provided with or without a trailing slash (#784) * Ignore trailing / in host name The trailing / is often added automatically when copy pasting Before this change, you would get "Database Error - failed to connect" After this change, the trailing backslash won't prevent your connection * Update changelog --------- Co-authored-by: colin-rogers-dbt <111200756+colin-rogers-dbt@users.noreply.github.com> --- .changes/unreleased/Fixes-20230623-112100.yaml | 6 ++++++ dbt/adapters/spark/connections.py | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 .changes/unreleased/Fixes-20230623-112100.yaml diff --git a/.changes/unreleased/Fixes-20230623-112100.yaml b/.changes/unreleased/Fixes-20230623-112100.yaml new file mode 100644 index 000000000..d6129c908 --- /dev/null +++ b/.changes/unreleased/Fixes-20230623-112100.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Allow hostname to be provided with or without trailing slash +time: 2023-06-23T11:21:00.901430172Z +custom: + Author: tim-steinkuhler + Issue: "302" diff --git a/dbt/adapters/spark/connections.py b/dbt/adapters/spark/connections.py index bde614fa7..2a7f8188d 100644 --- a/dbt/adapters/spark/connections.py +++ b/dbt/adapters/spark/connections.py @@ -139,6 +139,9 @@ def __post_init__(self) -> None: f"ImportError({e.msg})" ) from e + if self.method != SparkConnectionMethod.SESSION: + self.host = self.host.rstrip("/") + @property def type(self) -> str: return "spark"