Skip to content

Commit

Permalink
Allow hostname to be provided with or without a trailing slash (#784)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
tim-steinkuhler and colin-rogers-dbt authored Jun 26, 2023
1 parent 8ea1597 commit b4a2f94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230623-112100.yaml
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions dbt/adapters/spark/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b4a2f94

Please sign in to comment.