> ## Documentation Index
> Fetch the complete documentation index at: https://deepline.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Databricks: Actions/run Query

> Run a read-only SQL query on your Databricks SQL warehouse and get back the rows. Includes inputs, outputs, SDK V2 examples, and Deepline cost.

Run a read-only SQL query on your Databricks SQL warehouse and get back the rows.

> [!NOTE]
>
> Tool ID: `databricks_run_query`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'databricks_run_query',
  {
    "query": "software companies hiring engineers"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline tools execute databricks_run_query --input '{
  "query": "software companies hiring engineers"
}' --json
```

## Example response

The SDK returns this shape at `result.toolResponse.raw`. The example values illustrate the response.

```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
{
  "data": {
    "rows": [
      {}
    ],
    "rowCount": 123,
    "limited": true,
    "columns": [
      "example"
    ],
    "statementId": "statement_123"
  },
  "meta": {}
}
```

Use `deepline describe databricks_run_query --json` for the latest machine-readable contract.

## Input reference

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.credentials` | `object` | No | — | — |
| `payload.query` | `string` | Yes | — | — |
| `payload.parameters` | `array` | No | — | Maximum items: 1000. |
| `payload.queryTags` | `array` | No | — | Optional Databricks query-history tags. Keys beginning with deepline\_ are reserved. Maximum items: 16. |
| `payload.rowLimit` | `integer` | No | `5000` | Minimum: 1. Maximum: 100000. |
| `payload.timeoutMs` | `integer` | No | `120000` | Minimum: 1000. Maximum: 600000. |
| `payload.write` | `false` | No | `false` | Databricks writes are unsupported because Statement Execution has no submission idempotency key. Only read-only SELECT or WITH statements are accepted. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "properties": {
      "credentials": {
        "type": "object",
        "properties": {
          "host": {
            "type": "string",
            "description": "HTTPS Databricks workspace URL."
          },
          "token": {
            "type": "string",
            "description": "Databricks PAT or OAuth access token."
          },
          "client_id": {
            "type": "string",
            "description": "Databricks service-principal OAuth client ID."
          },
          "client_secret": {
            "type": "string",
            "description": "Databricks service-principal OAuth secret."
          },
          "assume_group": {
            "type": "string",
            "description": "Optional Databricks RBAC group id to assume for OAuth M2M execution."
          },
          "warehouse_id": {
            "type": "string",
            "description": "Databricks SQL warehouse ID."
          },
          "catalog": {
            "type": "string"
          },
          "schema": {
            "type": "string"
          }
        },
        "required": [
          "host",
          "warehouse_id"
        ],
        "additionalProperties": false
      },
      "query": {
        "type": "string"
      },
      "parameters": {
        "type": "array",
        "maxItems": 1000,
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "value": {
              "type": [
                "string",
                "null"
              ]
            },
            "type": {
              "type": "string"
            }
          },
          "required": [
            "name",
            "value"
          ],
          "additionalProperties": false
        }
      },
      "queryTags": {
        "type": "array",
        "description": "Optional Databricks query-history tags. Keys beginning with deepline_ are reserved.",
        "maxItems": 16,
        "items": {
          "type": "object",
          "properties": {
            "key": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "value": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "key"
          ],
          "additionalProperties": false
        }
      },
      "rowLimit": {
        "type": "integer",
        "default": 5000,
        "minimum": 1,
        "maximum": 100000
      },
      "timeoutMs": {
        "type": "integer",
        "default": 120000,
        "minimum": 1000,
        "maximum": 600000
      },
      "write": {
        "type": "boolean",
        "description": "Databricks writes are unsupported because Statement Execution has no submission idempotency key. Only read-only SELECT or WITH statements are accepted.",
        "default": false,
        "const": false
      }
    },
    "required": [
      "query"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | — |
| `result.data.rows` | `array` | Yes | — | — |
| `result.data.rowCount` | `integer` | Yes | — | — |
| `result.data.limited` | `boolean` | Yes | — | — |
| `result.data.columns` | `array` | Yes | — | — |
| `result.data.statementId` | `string \| null` | Yes | — | — |
| `result.data.sql` | `string` | No | — | — |
| `result.data.dataset` | `record` | No | — | — |
| `result.meta` | `record` | Yes | — | — |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "properties": {
      "data": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": {}
            }
          },
          "rowCount": {
            "type": "integer"
          },
          "limited": {
            "type": "boolean"
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "statementId": {
            "type": [
              "string",
              "null"
            ]
          },
          "sql": {
            "type": "string"
          },
          "dataset": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "required": [
          "rows",
          "rowCount",
          "limited",
          "columns",
          "statementId"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "additionalProperties": {}
      }
    },
    "required": [
      "data",
      "meta"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Databricks provider guide](https://deepline.com/docs/providers/databricks/guide.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.