-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow hostname to be provided with or without a trailing slash #784
Allow hostname to be provided with or without a trailing slash #784
Conversation
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Tim Steinkühler.
|
ccc479f
to
c1af8c8
Compare
c1af8c8
to
96c29f0
Compare
Hi @colin-rogers-dbt (I see you are assigned as reviewer), I'm finding it a bit difficult to relate the CI error message "at least one column must be specified for the table" to the changes I made. If I did mess this up, I would expect a lot more tests to fai, not just that one, and I would expect a different error message. Could you help me get a better understanding? |
96c29f0
to
558910d
Compare
@Fokko, are you able to have a look at this? After a rebase on the latest version of main, the tests have been passed, although there are still 3 "expected" checks, how does this work? :-D |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tim-steinkuhler A maintainer (someone from dbt-labs) has to kick off the jobs. This is to avoid someone injecting malicious code into the CI. This isn't needed anymore once one PR is in. Unfortunately, it is a bit quiet on the dbt-spark
repository. I'm also trying to get a few PRs in. @VersusFacit would you have time to dig into this?
dbt/adapters/spark/connections.py
Outdated
@@ -278,7 +289,7 @@ class SparkConnectionManager(SQLConnectionManager): | |||
|
|||
SPARK_CLUSTER_HTTP_PATH = "/sql/protocolv1/o/{organization}/{cluster}" | |||
SPARK_SQL_ENDPOINT_HTTP_PATH = "/sql/1.0/endpoints/{endpoint}" | |||
SPARK_CONNECTION_URL = "{host}:{port}" + SPARK_CLUSTER_HTTP_PATH | |||
SPARK_CONNECTION_URL = "https://{host}:{port}" + SPARK_CLUSTER_HTTP_PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that by changing this, we cannot use http://
prefixes anymore. IDK if anyone uses this (maybe in test environments?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, wasn't that already the case before, with this code?
# Prepend https:// if it is missing
host = creds.host
if not host.startswith("https://"):
host = "https://" + creds.host
I tried to "standardize" the host name in SparkCredentials. __post_init__()
, so it wouldn't matter if you added the prefix and / or the trailing /
, and then added this here, because you had the https:// prefix for the http
connection method
By the way, thank you @Fokko! Your feedback is much appreciated! |
6b793ce
to
160d365
Compare
I don't think my change could lead to this error message in the |
@tim-steinkuhler : Could you force a new commit to restart the CI? I do not understand why the |
@tim-steinkuhler : Ok, that did not do the trick unfortunately. Let's discuss an approach for this in person! |
21c99d8
to
cae2e08
Compare
5a0aa24
to
54dde46
Compare
After a short discussion with @JCZuurmond , we decided to not remove the |
54dde46
to
f7b9bf0
Compare
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
f7b9bf0
to
7aa2460
Compare
@colin-rogers-dbt : Could you help with the CI again? Given the code changes and that the CI passed before, I expect that the CI fails because it is a bit flacky. @Fleid: This PR is ready to be merged. Could you merge it once the CI is fixed? |
Thanks for the contribution! |
resolves #302
Description
Allow hostname to be provided with or without trailing slash
When you copy in the hostname, it may or may not include trailing
/
We could avoid confusion by allowing users to include or exclude these elements.
Before this change,
dbt debug
would get you something like this:Output while using a trailing slash after change (given credentials are correct):
Checklist
changie new
to create a changelog entry