Note
This SDK is in Beta and is supported for production use cases. Interfaces might still change slightly before GA (e.g. name standardization and minor ergonomic tweaks). We are keen to hear feedback from early adopters — please file issues, and we will address them.
The Databricks SDKs for Go provide typed clients for the Databricks REST API. They have a modular architecture, with a separate Go module for each API (for example, github.com/databricks/sdk-go/postgres).
The SDK requires Go 1.26 or later. Install the module for each API you need. For example, to work with Postgres:
go get github.com/databricks/sdk-go/postgres@latestBy default, a client reads its host and credentials from a Databricks configuration profile (~/.databrickscfg) and DATABRICKS_* environment variables. With those set, no credentials need to be passed in code:
import "github.com/databricks/sdk-go/postgres/v1"
postgresClient, err := postgres.NewClient(ctx)
if err != nil {
return err
}To configure credentials explicitly, create credentials with github.com/databricks/sdk-go/auth/credentials and pass client options from github.com/databricks/sdk-go/options/client:
import (
"github.com/databricks/sdk-go/auth/credentials"
clientopts "github.com/databricks/sdk-go/options/client"
"github.com/databricks/sdk-go/postgres/v1"
)
pat, err := credentials.NewPATCredentials("<personal-access-token>")
if err != nil {
return err
}
postgresClient, err := postgres.NewClient(
ctx,
clientopts.WithHost("https://example.cloud.databricks.com"),
clientopts.WithCredentials(pat),
)
if err != nil {
return err
}The following lists the Postgres projects you can access, using the default authentication described above. Iterator methods page through results transparently:
import (
"context"
"fmt"
"github.com/databricks/sdk-go/postgres/v1"
)
func listProjects(ctx context.Context) error {
postgresClient, err := postgres.NewClient(ctx)
if err != nil {
return err
}
for project, err := range postgresClient.ListProjectsIter(ctx, postgres.ListProjectsRequest{}) {
if err != nil {
return err
}
fmt.Println(project)
}
return nil
}Additional runnable examples are available in examples and package-specific example directories such as files/examples.
Each Databricks API is published as a separate module named github.com/databricks/sdk-go/<api>. Import its client from the module's versioned package — for example, github.com/databricks/sdk-go/postgres/v1 exports postgres.Client.
Three modules are shared by every API client and provide the pieces you import directly:
github.com/databricks/sdk-go/core— configuration-profile resolution, API errors, retry and rate-limiting primitives, client metadata, and shared types.github.com/databricks/sdk-go/auth— credential providers and the default credential chain.github.com/databricks/sdk-go/options— options for clients, calls, and long-running operations.
This project is licensed under the Apache License 2.0. See LICENSE and NOTICE.