# Databricks

> List and run jobs, inspect runs, and view SQL warehouses in your Databricks workspace.

App · Databases · 7 actions. Web page: https://docs.lodol.com/docs/integrations/databricks

## Actions

### Find job

Look up a single Databricks job and its full definition by ID.

**Inputs**

- Job (`job_id`, number, required): Pick a job, or enter its numeric ID.

**Outputs**

- `created_time` (number): When the job was created (epoch ms)
- `job_id` (number): The job's ID
- `settings` (object): The job's settings

**Example output**

```json
{
  "created_time": 1700000000000,
  "creator_user_name": "user@example.com",
  "job_id": 12345,
  "settings": {
    "name": "Nightly ETL",
    "tasks": [
      {
        "task_key": "ingest"
      }
    ]
  }
}
```

### Find run

Look up a single job run and its current state by run ID.

**Inputs**

- Run (`run_id`, number, required): Pick a recent run, or enter its numeric ID.

**Outputs**

- `job_id` (number): The ID of the job this run belongs to
- `run_id` (number): The run's ID
- `state` (object): Life-cycle and result state of the run

**Example output**

```json
{
  "job_id": 12345,
  "run_id": 67890,
  "run_name": "Nightly ETL",
  "run_page_url": "https://dbc-1234.cloud.databricks.com/#job/12345/run/1",
  "state": {
    "life_cycle_state": "TERMINATED",
    "result_state": "SUCCESS"
  }
}
```

### Find SQL warehouse

Look up a single SQL warehouse's configuration and state by ID.

**Inputs**

- SQL warehouse (`warehouse_id`, text, required): Pick a SQL warehouse, or enter its ID.

**Outputs**

- `id` (text): The SQL warehouse's ID
- `name` (text): The SQL warehouse's name
- `state` (text): Current state (e.g. RUNNING, STOPPED)

**Example output**

```json
{
  "cluster_size": "Small",
  "creator_name": "user@example.com",
  "id": "0123456789abcdef",
  "name": "Serverless Starter Warehouse",
  "num_clusters": 1,
  "state": "RUNNING"
}
```

### List jobs

List the jobs defined in your Databricks workspace. Results come back a page at a time when there are many.

**Inputs**

- Limit (`limit`, number): Maximum number of results to return in one page (up to 100). From 1 to 100.
- Next page token (`page_token`, text): To get the next page of results, paste the next page token from a previous run's results. Leave blank to start from the first page.
- Name (`name`, text): Only return jobs whose name matches this value exactly.

**Outputs**

- `has_more` (true/false): Whether more results are available
- `jobs` (list): List of jobs
- `jobs_count` (number): Number of jobs returned on this page
- `next_page_token` (text): Token for fetching the next page

**Example output**

```json
{
  "has_more": false,
  "jobs": [
    {
      "created_time": 1700000000000,
      "job_id": 12345,
      "settings": {
        "name": "Nightly ETL"
      }
    }
  ],
  "jobs_count": 1,
  "next_page_token": null
}
```

### List runs

List job runs in your workspace. Optionally narrow to a single job or to only active or only completed runs.

**Inputs**

- Job (`job_id`, number): Pick a job to filter by, or leave blank for all jobs.
- Active only (`active_only`, true/false): Only return runs that are currently active (in progress).
- Completed only (`completed_only`, true/false): Only return runs that have already finished.
- Limit (`limit`, number): Maximum number of runs to return in one page (up to 25). From 1 to 25.
- Next page token (`page_token`, text): To get the next page of results, paste the next page token from a previous run's results. Leave blank to start from the first page.

**Outputs**

- `has_more` (true/false): Whether more results are available
- `next_page_token` (text): Token for fetching the next page
- `runs` (list): List of runs
- `runs_count` (number): Number of runs returned on this page

**Example output**

```json
{
  "has_more": false,
  "next_page_token": null,
  "runs": [
    {
      "job_id": 12345,
      "run_id": 67890,
      "run_name": "Nightly ETL",
      "state": {
        "life_cycle_state": "TERMINATED",
        "result_state": "SUCCESS"
      }
    }
  ],
  "runs_count": 1
}
```

### List SQL warehouses

List all SQL warehouses in the workspace. SQL warehouses are a separate compute type from clusters.

**Inputs**: None.

**Outputs**

- `warehouses` (list): List of SQL warehouses
- `warehouses_count` (number): Number of SQL warehouses returned

**Example output**

```json
{
  "warehouses": [
    {
      "cluster_size": "Small",
      "id": "0123456789abcdef",
      "name": "Serverless Starter Warehouse",
      "state": "RUNNING"
    }
  ],
  "warehouses_count": 1
}
```

### Run job

Trigger a single run of an existing Databricks job right away.

**Inputs**

- Job (`job_id`, number, required): Pick a job, or enter its numeric ID.
- Notebook parameters (`notebook_params`, object): Optional values to pass to the job's notebook when it runs, entered as names and values.

**Outputs**

- `number_in_job` (number): The run number within the job
- `run_id` (number): The ID of the triggered run

**Example output**

```json
{
  "number_in_job": 1,
  "run_id": 67890
}
```
