Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Databricks

Databricks

Databricks on your own workspace: run SQL on a SQL warehouse, start and check jobs and runs, inspect and start or terminate clusters, browse Unity Catalog catalogs, schemas and tables, and list workspace folders. You give your workspace address and a personal access token.

15 actions API key 11 read2 write2 destructive Calls www.databricks.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "databricks" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

This toolkit uses a single credential and requests no scopes.

Actions

Execute SQL statementdestructivedatabricks.execute_sqlRun a SQL statement on a Databricks SQL warehouse and return up to the first rows inline. The statement can be anything the token's user may run, including INSERT, UPDATE, DELETE, DROP and TRUNCATE, so it is treated as destructive and needs confirmation: prefer plain SELECT statements and use row_limit. If it does not finish within wait_timeout it keeps running and you poll get_statement with the returned statement_id.
InputTypeDescription
statementstringRequiredThe SQL to run (up to 16 MiB)
warehouse_idstringRequiredID of the SQL warehouse that runs it, from list_warehouses
catalogstringOptionalDefault catalog for unqualified names (like USE CATALOG)
schemastringOptionalDefault schema for unqualified names (like USE SCHEMA)
wait_timeoutstringOptionalHow long to wait for the result: 0s (return immediately) or 5s to 50s. Default 10s
row_limitintegerOptionalCap the number of rows returned (sets truncated when hit)
parametersarray of objectOptionalNamed parameter markers (:name) used in the statement
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.execute_sql",
  input: {
    "statement": "<statement>",
    "warehouse_id": "<warehouse_id>"
  },
  confirm: true,
});
Get clusterreaddatabricks.get_clusterGet one cluster's state, Spark version, node type, size, auto-termination and creator.
InputTypeDescription
cluster_idstringRequiredCluster ID, from list_clusters
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.get_cluster",
  input: {
    "cluster_id": "<cluster_id>"
  },
});
Get jobreaddatabricks.get_jobGet one job's definition: name, schedule, concurrency limit and its tasks.
InputTypeDescription
job_idintegerRequiredJob ID, from list_jobs
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.get_job",
  input: {
    "job_id": 1
  },
});
Get job runreaddatabricks.get_runGet the status of a job run: lifecycle state (PENDING, RUNNING, TERMINATED...), result state (SUCCESS, FAILED...), timings and a link to the run page.
InputTypeDescription
run_idintegerRequiredRun ID, from run_job
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.get_run",
  input: {
    "run_id": 1
  },
});
Get SQL statement resultreaddatabricks.get_statementCheck the status of a SQL statement started with execute_sql and, once SUCCEEDED, get the first chunk of its rows. Statements are removed about 12 hours after they finish.
InputTypeDescription
statement_idstringRequiredStatement ID returned by execute_sql
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.get_statement",
  input: {
    "statement_id": "<statement_id>"
  },
});
List Unity Catalog catalogsreaddatabricks.list_catalogsList the Unity Catalog catalogs the token's user can see, with owner, comment and type.
InputTypeDescription
max_resultsintegerOptionalMaximum catalogs to return
page_tokenstringOptionalToken from a previous call's next_page_token, for the next page
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.list_catalogs",
  input: {},
});
List clustersreaddatabricks.list_clustersList the all-purpose and job clusters in the workspace with ID, name, state (RUNNING, TERMINATED, PENDING...), Spark version, node type and worker count.
InputTypeDescription
page_sizeintegerOptionalClusters per page (max 100)
page_tokenstringOptionalToken from a previous call's next_page_token, for the next page
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.list_clusters",
  input: {},
});
List jobsreaddatabricks.list_jobsList Databricks jobs (Lakeflow Jobs / workflows) in the workspace with their ID, name, creator and schedule. Optionally filter by exact name.
InputTypeDescription
namestringOptionalOnly jobs with exactly this name (case-insensitive)
limitintegerOptionalJobs per page (1-100, default 20)
page_tokenstringOptionalToken from a previous call's next_page_token, for the next page
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.list_jobs",
  input: {},
});
List Unity Catalog schemasreaddatabricks.list_schemasList the schemas (databases) inside one Unity Catalog catalog.
InputTypeDescription
catalog_namestringRequiredCatalog name, from list_catalogs
max_resultsintegerOptionalMaximum schemas to return
page_tokenstringOptionalToken from a previous call's next_page_token, for the next page
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.list_schemas",
  input: {
    "catalog_name": "<catalog_name>"
  },
});
List Unity Catalog tablesreaddatabricks.list_tablesList the tables and views in one Unity Catalog schema. Set omit_columns to true for a short answer; leave it off to also get each table's column names and types.
InputTypeDescription
catalog_namestringRequiredCatalog name
schema_namestringRequiredSchema name, from list_schemas
omit_columnsbooleanOptionalLeave out the column lists (shorter output)
max_resultsintegerOptionalMaximum tables to return
page_tokenstringOptionalToken from a previous call's next_page_token, for the next page
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.list_tables",
  input: {
    "catalog_name": "<catalog_name>",
    "schema_name": "<schema_name>"
  },
});
List SQL warehousesreaddatabricks.list_warehousesList the SQL warehouses the token's user can use, with ID, name, size, state (STARTING, RUNNING, STOPPED...) and type. The warehouse ID is needed by execute_sql.
InputTypeDescription
page_sizeintegerOptionalMaximum warehouses to return
page_tokenstringOptionalToken from a previous call's next_page_token, for the next page
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.list_warehouses",
  input: {},
});
List workspace objectsreaddatabricks.list_workspace_objectsList the notebooks, folders, files and libraries directly inside a workspace folder path such as /Users/[email protected] or /Workspace/Shared.
InputTypeDescription
pathstringRequiredAbsolute workspace path of the folder, e.g. /Users/[email protected]
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.list_workspace_objects",
  input: {
    "path": "<path>"
  },
});
Run job nowwritedatabricks.run_jobStart a run of an existing job right now, optionally with job parameters. Starts compute and executes the job's tasks, which can change data. Use an idempotency_token to avoid starting the same run twice on retries. Poll get_run with the returned run_id.
InputTypeDescription
job_idintegerRequiredJob ID, from list_jobs
job_parametersobjectOptionalJob-level parameters as name to text value pairs
idempotency_tokenstringOptionalOptional unique token (max 64 characters); a retry with the same token returns the same run
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.run_job",
  input: {
    "job_id": 1
  },
});
Start clusterwritedatabricks.start_clusterStart a terminated cluster. It begins using compute that is billed. The call returns at once; poll get_cluster until its state is RUNNING.
InputTypeDescription
cluster_idstringRequiredID of the terminated cluster to start
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.start_cluster",
  input: {
    "cluster_id": "<cluster_id>"
  },
});
Terminate clusterdestructivedatabricks.terminate_clusterTerminate a cluster: it stops, running jobs and notebooks on it are interrupted, and its configuration is kept so it can be started again (this is not a permanent delete).
InputTypeDescription
cluster_idstringRequiredID of the cluster to terminate
TypeScript
await setu.execute({
  userId: "user_1",
  action: "databricks.terminate_cluster",
  input: {
    "cluster_id": "<cluster_id>"
  },
  confirm: true,
});