- 1
-
{odbc}recently addedodbc::databricks()to simplify connecting to Databricks (requires version>=1.4.0) - 2
-
The
httpPathcan be found in the âConnection Detailsâ tab of a SQL warehouse - 3
-
workspacerefers to the workspace URL, also found in âConnection Detailsâ tab as âServer hostnameâ - 4
-
The docs mention setting
AuthMechto11andAuth_Flowto2
9 OAuth đ¤ {odbc}
When using {odbc} to connect to Databricks clusters and SQL warehouses youâll likely have used a personal access token (PAT). Itâs not uncommon for workspace administrators to disable the use of PATs.
If you are unable to create a PAT you are still able to connect to Databricks but youâll need to use OAuth (either M2M or U2M).
User-to-machine (U2M) is typically what youâd want to use. The Databricks ODBC driver supports OAuth flows, but the minimum driver version differs by flow:
- OAuth token passthrough / M2M requires
2.7.5or above - Browser-based OAuth U2M requires
2.8.2or above
9.1 U2M Example
OAuth U2M or OAuth 2.0 browser-based authentication works only with applications that run locally. It does not work with server-based or cloud-based applications.
When running this code you should be prompted to login to the workspace or youâll see a window that says âsuccessâ. You can close the window and continue working in R.