databricks/databricks-sdk-java
Java
Captured source
source ↗databricks/databricks-sdk-java
Description: Databricks SDK for Java
Language: Java
License: Apache-2.0
Stars: 57
Forks: 36
Open issues: 46
Created: 2023-01-12T17:11:26Z
Pushed: 2026-06-11T03:39:36Z
Default branch: main
Fork: no
Archived: no
README:
Databricks SDK for Java

Stability: Beta
The Databricks SDK for Java includes functionality to accelerate development with Java for the Databricks Lakehouse. It covers all public Databricks REST API operations. The SDK's internal HTTP client is robust and handles failures on different levels by performing intelligent retries.
Contents
- [Getting started](#getting-started)
- [Authentication](#authentication)
- [Code examples](#code-examples)
- [Long-running operations](#long-running-operations)
- [Paginated responses](#paginated-responses)
- [Retries](#retries)
- [Single-sign-on with OAuth](#single-sign-on-sso-with-oauth)
- [Error handling](#error-handling)
- [Logging](#logging)
- [Proxy](#proxy)
- [Interface stability](#interface-stability)
- [Disclaimer](#disclaimer)
Getting started
You can install Databricks SDK for Java by adding the following to your pom.xml:
com.databricks databricks-sdk-java 0.0.1
Using the SDK is as simple as instantiating the WorkspaceClient class:
import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.AccountClient;
import com.databricks.sdk.core.DatabricksConfig;
import com.databricks.sdk.service.compute.ClusterInfo;
import com.databricks.sdk.service.compute.ListClustersRequest;
public class App {
public static void main(String[] args) {
WorkspaceClient workspace = new WorkspaceClient();
for (ClusterInfo c : workspace.clusters().list(new ListClustersRequest())) {
System.out.println(c.getClusterName());
}
}
}To access account-level APIs, you can instantiate the AccountClient class:
import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.AccountClient;
import com.databricks.sdk.core.DatabricksConfig;
import com.databricks.sdk.service.compute.ClusterInfo;
import com.databricks.sdk.service.compute.ListClustersRequest;
public class App {
public static void main(String[] args) {
AccountClient account = new AccountClient();
for (Workspace w : account.workspaces().list()) {
System.out.println(w.getWorkspaceName());
}
}
}Databricks SDK for Java is compatible with Java 8 and higher. CI testing runs on Java versions 8, 11, 17, and 20.
Authentication
If you use Databricks configuration profiles or Databricks-specific environment variables for Databricks authentication, the only code required to start working with a Databricks workspace is the following code snippet, which instructs the Databricks SDK for Java to use its [default authentication flow](#default-authentication-flow):
import com.databricks.sdk.WorkspaceClient; ... WorkspaceClient workspace = new WorkspaceClient(); workspace. // press for autocompletion
In this section
- [Default authentication flow](#default-authentication-flow)
- [Unified host support](#unified-host-support)
- [Databricks native authentication](#databricks-native-authentication)
- [Azure native authentication](#azure-native-authentication)
- [Google Cloud Platform native authentication](#google-cloud-platform-native-authentication)
- [Overriding .databrickscfg](#overriding-databrickscfg)
- [Additional authentication configuration options](#additional-authentication-configuration-options)
Default authentication flow
If you run the Databricks Terraform Provider, the Databricks SDK for Go, the Databricks SDK for Python, the Databricks CLI, or applications that target the Databricks SDKs for other languages, most likely they will all interoperate nicely together. By default, the Databricks SDK for Java tries the following authentication methods, in the following order, until it succeeds:
1. [Databricks native authentication](#databricks-native-authentication) 2. [Azure native authentication](#azure-native-authentication) 3. [Google Cloud Platform native authentication](#google-cloud-platform-native-authentication) 4. If the SDK is unsuccessful at this point, it returns an authentication error and stops running.
Each authentication method requires specific configuration attributes (e.g., token for PAT auth, azureClientId for Azure service principal auth). The SDK automatically detects the cloud provider and skips authentication methods whose required configuration attributes are not present. This means that Azure-specific methods like azure-cli are automatically skipped when connecting to an AWS or GCP workspace, and vice versa for GCP-specific methods.
To force a specific authentication method instead of relying on auto-detection, set the authType on DatabricksConfig:
import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.core.DatabricksConfig;
...
// Force Azure CLI authentication — skip all other methods
DatabricksConfig config = new DatabricksConfig()
.setHost("https://mycompany.databricks.com")
.setAuthType("azure-cli");
WorkspaceClient workspace = new WorkspaceClient(config);This is useful when your environment has credentials for multiple authentication methods and you want to ensure a specific one is used, or when auto detection is not accurate.
For each authentication method, the SDK searches for compatible authentication credentials in the following locations, in the following order. Once the SDK finds a compatible set of credentials that it can use, it stops searching:
1. Credentials that are hard-coded into configuration arguments.
:warning: Caution: Databricks does not recommend hard-coding credentials into…
Excerpt shown — open the source for the full document.