Skip to content

Commit

Permalink
Fix handling of bare DATABRICKS_HOST URLs. (#25)
Browse files Browse the repository at this point in the history
Some platforms set DATABRICKS_HOST without the leading "https" for
compatibility with existing ODBC code. Most other Databricks SDKs seem
to detect this automatically and prefix the host as required, but until
this commit this one did not.

(Note that this SDK is currently unusable inside Posit Workbench as a
result of this limitation.)

Closes #22.

Signed-off-by: Aaron Jacobs <[email protected]>
  • Loading branch information
atheriel authored Mar 21, 2024
1 parent 2f55e63 commit 4579e22
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/api_client.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ DatabricksClient <- function(profile = NULL, host = NULL, token = NULL, config_f
client_id = coalesce(Sys.getenv("DATABRICKS_CLIENT_ID"), from_cli$client_id),
client_secret = coalesce(Sys.getenv("DATABRICKS_CLIENT_SECRET"), from_cli$client_secret))

# add the missing https:// prefix to bare, ODBC-style hosts
if (!is.null(cfg$host) && !startsWith(cfg$host, "http")) {
cfg$host <- paste0("https://", cfg$host)
}

# debug_string iterates over currently resolved configuration and returns a
# single string with all config key-value pairs that are effective in the
# current state. Sensitive values are redated. Unlike Go, Python, or Java
Expand Down

0 comments on commit 4579e22

Please sign in to comment.