Skip to content
BlokloDocumentation

Databricks

SQL queries on Databricks (SQL warehouse) and workspace data.

Connection type: For the app and the agent. Credentials: Workspace URL, Personal access token (PAT).

How it works

The app and the agent never see the credentials. They call the Databricks API through the Bloklo gateway, for example fetch("/gw/<connection id>/api/2.0/sql/warehouses"). The gateway appends the path to the address given in the connection, adds an Authorization: Bearer … header with the key from the connection, and passes the service's response back to the app.

  • Reads (GET) go through at once. Writes (POST, PUT, PATCH, DELETE) go through at once only when the connection is set to Always allow; otherwise the gateway returns status 202 with an approval_id and the write waits for approval in the panel (see Agent permissions).
  • The Test button sends GET /api/2.0/preview/scim/v2/Me and checks that the service accepted the credentials.

REST on the workspace URL, JSON bodies. SQL runs through the Statement Execution API with a SQL warehouse ID; long queries return an ID to poll, and large results are split into chunks.

Before you start

  • An account with Databricks with permission to create API keys or tokens.

Where to get the credentials

  1. In Databricks, open Settings → Developer → Access tokens → Generate new token and copy the token.
  2. Copy the workspace URL and the SQL warehouse ID (SQL Warehouses → Connection details).
Note

Databricks treats personal tokens as a legacy method and revokes unused ones after 90 days. Queries use the customer's warehouse resources.

Databricks documentation

Connecting in Bloklo

  1. Open Connectors in the sidebar and find Databricks.
  2. Click Connect and enter a connection name in Details.
  3. In Configure connection, fill in: Workspace URL, Personal access token (PAT), SQL warehouse ID (optional).
  4. Click Connect. Bloklo saves the credentials encrypted and sends a test request; the message shows whether the service responded.
  5. Attach the connection to a project: Attach to a project… on the connection page, or describe the task in the project chat and pick the connection the agent suggests.

Form fields

  • Workspace URL: The address where the Databricks workspace opens.
  • Personal access token (PAT): Settings → Developer → Access tokens → Generate new token. Databricks revokes unused tokens after 90 days.
  • SQL warehouse ID (optional) (optional): SQL Warehouses → the warehouse → Connection details → HTTP path (the part after /warehouses/).
Important

Never paste credentials into the chat with the agent. Enter them only in the connection form.

Example prompts

Prompts to type in the chat of a project with the connection attached:

  • “Build a sales dashboard from a SQL query on our warehouse.”
  • “Add a weekly report page fed from a Databricks table.”
  • “Show the list of warehouses and the state of each one.”

API methods

The most commonly used Databricks API methods. The path goes after /gw/<connection id>; parts in braces, such as {id}, are replaced with values. The gateway treats every request other than GET as a write, including queries sent with POST (such as search or GraphQL), so they need approval unless the connection is set to Always allow. The full list of methods is in the provider's documentation.

MethodPathWhat it doesIn the gateway
POST/api/2.0/sql/statementsRun a SQL statement on a warehousewrite (approval)
GET/api/2.0/sql/statements/{statement_id}Statement status and resultread
POST/api/2.0/sql/statements/{statement_id}/cancelCancel a statementwrite (approval)
GET/api/2.0/sql/statements/{statement_id}/result/chunks/{chunk_index}Fetch a result chunkread
GET/api/2.0/sql/warehousesList SQL warehousesread
GET/api/2.0/preview/scim/v2/MeCurrent user detailsread

Service limits

Statement text up to 16 MiB. INLINE results up to 25 MiB (larger aborts the statement); EXTERNAL_LINKS up to 100 GiB, links valid 15 minutes. wait_timeout: 0s or 5–50 s (default 10 s). Statement state is removed 12 hours after finishing (404). Limits vary by API, e.g. Workspace API list 50 requests/s, workspace SCIM 255 reads/min.

Databricks API reference

Agent actions and permissions

ActionTypeWhat the agent uses it for
Read datareadFetches data from the service, such as a list of records, to build and check the app. Examples: statement status and result; fetch a result chunk; list SQL warehouses.
Write datawriteRequests other than GET: creating, changing or deleting data in the service, and also queries sent with POST (such as search). Examples: run a SQL statement on a warehouse; cancel a statement.
Tip

By default, reads run without asking and writes need approval in the chat. Change this on the connector page or in Settings → Agent permissions (see Agent permissions).

Troubleshooting

The connection test shows “Invalid key” (HTTP 401)

The service did not recognise the credentials: the value is wrong, expired, revoked or was copied with a space. Create a new key at the provider and enter it on the connection page under Change credentials. Empty fields stay unchanged.

The connection test shows “Invalid key” (HTTP 403)

The credentials are rejected or lack the needed permissions, or the service only accepts requests from selected IP addresses. Check the key, extend its permissions at the provider or add the Bloklo gateway IP address (shown in Settings → Privacy & security) to the allowlist.

The test returns another HTTP code

The Test button sends the service a read request that requires valid credentials. A code other than 401 and 403 usually means a temporary problem at the service or a restriction on the account at the provider; include the error code shown with the result in a problem report.

Limits and security

  • One connection can make up to 1,000 requests per minute; the service's own limits also apply.
  • Credentials are encrypted and not shown in the browser after saving; only the names of stored fields are visible.
  • A published app works for every visitor: protect the data the connection gives access to with sign-in in the app.

Something unclear or out of date? Contact us