odbc
odbc copied to clipboard
Automate `httpPath` by pulling from Databricks REST API
The Databricks REST API has a “SQL warehouse” endpoint, where you can pull the httpPath
value from, here is an example using httr2
, which I guess odbc
would need to take a dependency against, unless y’all prefer to implement something like this at a lower level, here’s the example:
library(httr2)
warehouses <- paste0(
Sys.getenv("DATABRICKS_HOST"),
"/api/2.0/sql/warehouses"
) %>%
request() %>%
req_auth_bearer_token(Sys.getenv("DATABRICKS_TOKEN")) %>%
req_perform() %>%
resp_body_json()
# The path is in a specific location inside the object returned by the API
warehouses[[1]][[1]]$odbc_params$path
I was thinking it makes sense to automate seeing that it may be the only argument in databricks()
that does not yet have a way, even in a happy path, for it to be automated.