> ## 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

> Running one read-only parameterized Databricks SQL statement on a configured SQL warehouse. Includes inputs, outputs, SDK V2 examples, and Deepline cost.

Running one read-only parameterized Databricks SQL statement on a configured SQL warehouse.

<Info>
  Tool ID: `databricks_run_query`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
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={null}
deepline tools execute databricks_run_query --input '{
  "query": "software companies hiring engineers"
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": {
    "rows": [
      {}
    ],
    "rowCount": 123,
    "limited": true,
    "columns": [
      "example"
    ],
    "statementId": "statement_123"
  },
  "meta": {}
}
```

Use `deepline tools get 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={null}
  {
    "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={null}
  {
    "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](/docs/providers/databricks/guide)
* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)
