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 JavaScript provide typed clients for the Databricks REST API. They have a modular architecture, with a separate npm package for each API (for example, @databricks/sdk-postgres).
Install the package for each API you need. For example, to work with Postgres:
npm install @databricks/sdk-postgresBy default, a client reads its configuration (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 {PostgresClient} from '@databricks/sdk-postgres/v1';
// Resolves the host and credentials from the DEFAULT profile and DATABRICKS_* env vars.
const client = new PostgresClient({});To configure credentials explicitly, import a helper from @databricks/sdk-auth/credentials and pass it as credentials:
import {PostgresClient} from '@databricks/sdk-postgres/v1';
import {newPatCredentials} from '@databricks/sdk-auth/credentials';
const client = new PostgresClient({
host: 'https://example.cloud.databricks.com',
credentials: newPatCredentials('<personal-access-token>'),
});The following lists your Postgres projects, using the default authentication described above. List methods expose an Iter variant that pages through results transparently as you iterate:
import {PostgresClient} from '@databricks/sdk-postgres/v1';
const client = new PostgresClient({});
for await (const project of client.listProjectsIter({})) {
console.log(project.name);
}More runnable examples (pagination, long-running operations, error handling, and authentication strategies) are available in packages/examples.
Each Databricks API is published as a separate package named @databricks/sdk-<api>. Import its client from the package's versioned subpath — for example, @databricks/sdk-postgres/v1 exports PostgresClient.
Three packages are shared by every API client and provide the pieces you import directly:
@databricks/sdk-core— the HTTP client, configuration-profile resolution, logging, and API error types (ApiError).@databricks/sdk-auth— credential providers (newPatCredentials,newU2mCredentials,newM2mCredentials) and the default credential chain.@databricks/sdk-options— the option types passed to clients and calls (ClientOptions,CallOptions).
This project is licensed under the Apache License 2.0. See LICENSE and NOTICE.