Connecting to a serverless SQL warehouse from a user access token with odbc::databricks() requires setting the Databricks token to a global environment variable named DATABRICKS_TOKEN. If a user has their PAT assigned to the global env var DATABRICKS_TOKEN:
# This works
conn_1 <- DBI::dbConnect(
odbc::databricks(),
workspace = "https://some-corp.cloud.databricks.com",
httpPath = "sql/1.0/warehouse/e123456789101112"
)
# This also works
conn_2 <- DBI::dbConnect(
odbc::databricks(),
workspace = "https://some-corp.cloud.databricks.com",
token = Sys.getenv("DATABRICKS_TOKEN"),
httpPath = "sql/1.0/warehouse/e123456789101112"
)
However, the code below fails even if DATABRICKS_TOKEN_LAB is set in the .Renviron with the user's correct PAT:
# This fails because token is not specifically calling an env var named DATABRICKS_TOKEN
conn_3 <- DBI::dbConnect(
odbc::databricks(),
workspace = "https://some-corp.cloud.databricks.com",
token = Sys.getenv("DATABRICKS_TOKEN_LAB"),
httpPath = "sql/1.0/warehouse/e123456789101112"
)
I work with five (💀) Databricks instances at work so being able to connect to the different endpoints (all w/ different PATs) using different env var names would be very helpful. Thanks!
Connecting to a serverless SQL warehouse from a user access token with
odbc::databricks()requires setting the Databricks token to a global environment variable namedDATABRICKS_TOKEN. If a user has their PAT assigned to the global env varDATABRICKS_TOKEN:However, the code below fails even if
DATABRICKS_TOKEN_LABis set in the.Renvironwith the user's correct PAT:I work with five (💀) Databricks instances at work so being able to connect to the different endpoints (all w/ different PATs) using different env var names would be very helpful. Thanks!