Skip to content

Databricks

Jobs, runs, clusters, SQL warehouses, query history and pipelines as SQL tables

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/databricks/index.md to help me query Databricks with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

See when your scheduled jobs run

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT name, schedule_cron, schedule_timezone
FROM databricks.main.jobs
WHERE trigger_type = 'periodic' AND NOT schedule_paused
ORDER BY name

Quick start

Choose where to run Databricks, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'databricks' AS databricks (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-databricks-worker'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

databricks credentials

Connection to one Databricks workspace's REST API (AWS, Azure or GCP): the workspace URL plus a personal access token, an OAuth service principal (client id + secret), or an Azure AD token.

Get these credentials →
secret.sql
CREATE SECRET databricks (
    TYPE databricks,
    host          '<host>',  -- required
    token         '<DATABRICKS_TOKEN>',  -- secret
    client_id     '<client_id>',
    client_secret '<DATABRICKS_CLIENT_SECRET>',  -- secret
    azure_token   '<AZURE_TOKEN>',  -- secret
    auth_type     '<auth_type>',
    page_size     '<page_size>',
    timeout       '<timeout>'
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT name, schedule_cron, schedule_timezone
FROM databricks.main.jobs
WHERE trigger_type = 'periodic' AND NOT schedule_paused
ORDER BY name
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'databricks' AS databricks (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-databricks-worker'
);

Overview

The Databricks workspace control plane as SQL tables: Lakeflow Jobs and their runs, clusters, SQL warehouses and query history, declarative pipelines, Git folders and secret scopes. Read-only.

Catalog

Everything databricks exposes once attached — read straight from the worker's released build.

databricks 2 schemas
main 14 tables · 2 functions

Databricks workspace resources as tables: jobs and runs, compute, SQL, pipelines, workspace.

Schema examples (16)
Examples (16)

Scheduled jobs and their cron expressions

SELECT name, schedule_cron, schedule_timezone
FROM databricks.main.jobs
WHERE trigger_type = 'periodic' AND NOT schedule_paused
ORDER BY name;

Failed runs of one job in November 2026 (job_id and the start_time range are sent to the API)

SELECT run_id, start_time, state_message
FROM databricks.main.job_runs
WHERE job_id = 101 AND result_state = 'FAILED' AND start_time >= TIMESTAMPTZ '2026-11-01'
ORDER BY start_time;

Tasks that needed retries

SELECT run_id, task_key, count(*) AS attempts
FROM databricks.main.job_run_tasks
GROUP BY ALL
HAVING count(*) > 1
ORDER BY attempts DESC;

Running clusters and their owners (state is sent to the API)

SELECT cluster_name, creator_user_name, spark_version, num_workers
FROM databricks.main.clusters
WHERE state = 'RUNNING'
ORDER BY cluster_name;
12 more examples

Resize and termination events of one cluster

SELECT timestamp, type, current_num_workers, target_num_workers, reason_code
FROM databricks.main.cluster_events
WHERE cluster_id = '0915-120000-shared01' AND type IN ('RESIZING', 'TERMINATING')
ORDER BY timestamp;

Policies and how many clusters use each

SELECT p.name, count(c.cluster_id) AS clusters
FROM databricks.main.cluster_policies p
LEFT JOIN databricks.main.clusters c USING (policy_id)
GROUP BY p.name
ORDER BY p.name;

Pool utilisation

SELECT instance_pool_name, used_count, idle_count, max_capacity
FROM databricks.main.instance_pools
ORDER BY instance_pool_name;

Warehouses by size and type

SELECT name, cluster_size, warehouse_type, enable_serverless_compute, state
FROM databricks.main.sql_warehouses
ORDER BY name;

Failed queries per warehouse in one day (time range and status are sent to the API)

SELECT w.name, count(*) AS failed
FROM databricks.main.query_history q
JOIN databricks.main.sql_warehouses w USING (warehouse_id)
WHERE q.status = 'FAILED' AND q.query_start_time >= TIMESTAMPTZ '2026-11-14' AND q.query_start_time < TIMESTAMPTZ '2026-11-15'
GROUP BY w.name
ORDER BY failed DESC;

Unhealthy pipelines

SELECT name, state, latest_update_state
FROM databricks.main.pipelines
WHERE health = 'UNHEALTHY'
ORDER BY name;

Update outcomes per pipeline

SELECT p.name, u.state, count(*) AS updates
FROM databricks.main.pipeline_updates u
JOIN databricks.main.pipelines p USING (pipeline_id)
GROUP BY ALL
ORDER BY p.name, u.state;

Error events of one pipeline (pipeline_id and level are sent to the API)

SELECT timestamp, flow_name, message
FROM databricks.main.pipeline_events
WHERE pipeline_id = 'pl-orders-0001' AND level = 'ERROR'
ORDER BY timestamp;

Git folders not on main

SELECT path, url, branch
FROM databricks.main.repos
WHERE branch <> 'main'
ORDER BY path;

Secret scopes per backend

SELECT backend_type, list(scope ORDER BY scope) AS scopes
FROM databricks.main.secret_scopes
GROUP BY ALL
ORDER BY backend_type;

Error messages of the failed tasks of one job run

SELECT task_key, attempt_number, error
FROM databricks.main.run_output(2002)
WHERE error IS NOT NULL
ORDER BY task_key;

Notebooks per language under a user's home folder

SELECT language, count(*) AS notebooks
FROM databricks.main.workspace_objects('/Users/[email protected]', recursive := true)
WHERE object_type = 'NOTEBOOK'
GROUP BY language
ORDER BY notebooks DESC;
Tables
cluster_events 1 example10 cols

Cluster lifecycle events: starts, resizes, terminations, node loss.

Columns
cluster_idnot null VARCHAR
Cluster the event belongs to.
timestampnot null TIMESTAMP WITH TIME ZONE
When the event happened.
typenot null VARCHAR
Event type: CREATING, STARTING, RUNNING, RESIZING, UPSIZE_COMPLETED, TERMINATING, RESTARTING, EDITED, DRIVER_HEALTHY, NODES_LOST, AUTOSCALING_STATS_REPORT, ...
user VARCHAR
User who caused the event, when a user did.
current_num_workers BIGINT
Workers in the cluster at the event.
target_num_workers BIGINT
Target worker count at the event.
reason_code VARCHAR
details.reason.code, e.g. INACTIVITY, USER_REQUEST.
reason_type VARCHAR
details.reason.type, e.g. SUCCESS, CLIENT_ERROR.
cause VARCHAR
details.cause, e.g. AUTOSCALE, USER_REQUEST, AUTORECOVERY.
details JSON
The full event details (JSON).
Example

Resize and termination events of one cluster

SELECT timestamp, type, current_num_workers, target_num_workers, reason_code
FROM databricks.main.cluster_events
WHERE cluster_id = '0915-120000-shared01' AND type IN ('RESIZING', 'TERMINATING')
ORDER BY timestamp;
Link
cluster_policies 1 example9 cols

Cluster policies and their JSON definitions.

Columns
policy_idnot null VARCHAR
Unique cluster policy identifier.
name VARCHAR
Policy name.
description VARCHAR
Policy description.
creator_user_name VARCHAR
User who created the policy.
created_at TIMESTAMP WITH TIME ZONE
When the policy was created.
is_default BOOLEAN
True for a default policy Databricks provides.
max_clusters_per_user BIGINT
Maximum number of clusters (count) one user may create with the policy.
policy_family_id VARCHAR
Policy family it derives from, if any.
definition JSON
Policy definition (JSON): attribute → rule.
ConstraintsPRIMARY KEY (policy_id)
Example

Policies and how many clusters use each

SELECT p.name, count(c.cluster_id) AS clusters
FROM databricks.main.cluster_policies p
LEFT JOIN databricks.main.clusters c USING (policy_id)
GROUP BY p.name
ORDER BY p.name;
Link
clusters 2 examples28 cols

Databricks clusters (all-purpose and recent job clusters) with size, state and termination.

Columns
cluster_idnot null VARCHAR
Unique cluster identifier, e.g. '0915-120000-abcd1234'.
cluster_name VARCHAR
Display name given to the cluster by its creator.
state VARCHAR
PENDING, RUNNING, RESTARTING, RESIZING, TERMINATING, TERMINATED, ERROR, UNKNOWN.
state_message VARCHAR
Message about the current state.
cluster_source VARCHAR
Who created it: UI, API, JOB, PIPELINE, PIPELINE_MAINTENANCE, SQL, MODELS.
creator_user_name VARCHAR
User who created the cluster.
single_user_name VARCHAR
Assigned user of a single-user (dedicated) cluster.
data_security_mode VARCHAR
Access mode, e.g. SINGLE_USER, USER_ISOLATION, NONE.
spark_version VARCHAR
Databricks Runtime version key, e.g. '15.4.x-scala2.12'.
runtime_engine VARCHAR
STANDARD or PHOTON.
node_type_id VARCHAR
Worker node type.
driver_node_type_id VARCHAR
Driver node type.
num_workers BIGINT
Fixed worker count (or current count for autoscaling clusters).
autoscale_min_workers BIGINT
Autoscaling lower bound (count of workers); NULL when fixed size.
autoscale_max_workers BIGINT
Autoscaling upper bound (count of workers); NULL when fixed size.
autotermination_minutes BIGINT
Idle time before auto-termination, in minutes; 0 = never.
instance_pool_id VARCHAR
Instance pool the workers come from.
policy_id VARCHAR
Cluster policy applied (joins cluster_policies.policy_id).
cluster_memory_mb BIGINT
Total memory of the cluster in MB.
cluster_cores DOUBLE
Total CPU cores across driver and workers (count of cores).
start_time TIMESTAMP WITH TIME ZONE
When the cluster was created or last started.
terminated_time TIMESTAMP WITH TIME ZONE
When the cluster terminated, if it is terminated.
last_restarted_time TIMESTAMP WITH TIME ZONE
When the cluster was last restarted.
termination_code VARCHAR
termination_reason.code, e.g. INACTIVITY, JOB_FINISHED, USER_REQUEST.
termination_type VARCHAR
termination_reason.type: SUCCESS, CLIENT_ERROR, SERVICE_FAULT, CLOUD_FAILURE.
custom_tags MAP(VARCHAR, VARCHAR)
User-defined tags.
default_tags MAP(VARCHAR, VARCHAR)
Tags Databricks adds (Vendor, Creator, ClusterName, ClusterId, JobId, ...).
spark_conf MAP(VARCHAR, VARCHAR)
Spark configuration; secret-looking values masked '***'.
ConstraintsPRIMARY KEY (cluster_id)
Examples (2)

Running clusters and their owners (state is sent to the API)

SELECT cluster_name, creator_user_name, spark_version, num_workers
FROM databricks.main.clusters
WHERE state = 'RUNNING'
ORDER BY cluster_name;

Why clusters last terminated

SELECT termination_code, count(*) AS clusters
FROM databricks.main.clusters
WHERE state = 'TERMINATED'
GROUP BY ALL
ORDER BY clusters DESC;
Link
instance_pools 1 example13 cols

Instance pools with capacity settings and current usage.

Columns
instance_pool_idnot null VARCHAR
Pool id.
instance_pool_name VARCHAR
Pool name.
state VARCHAR
ACTIVE, STOPPED or DELETED.
node_type_id VARCHAR
Node type of the pool's instances.
min_idle_instances BIGINT
Count of idle instances the pool keeps warm.
max_capacity BIGINT
Maximum count of instances (idle + used).
idle_instance_autotermination_minutes BIGINT
Idle time before extra instances are released, in minutes.
preloaded_spark_versions VARCHAR[]
Runtime versions preloaded on idle instances.
used_count BIGINT
Count of instances in use by clusters.
idle_count BIGINT
Count of idle instances ready for clusters.
pending_used_count BIGINT
Count of instances being acquired for clusters.
pending_idle_count BIGINT
Count of idle instances being acquired.
custom_tags MAP(VARCHAR, VARCHAR)
User-defined tags.
ConstraintsPRIMARY KEY (instance_pool_id)
Example

Pool utilisation

SELECT instance_pool_name, used_count, idle_count, max_capacity
FROM databricks.main.instance_pools
ORDER BY instance_pool_name;
Link
job_run_tasks 2 examples24 cols

Every task attempt of every Databricks job run (retries are separate rows).

Columns
run_idnot null BIGINT
The parent job run (joins job_runs.run_id).
job_id BIGINT
Unique numeric identifier of the parent run's job; NULL for submit runs.
task_run_idnot null BIGINT
This task attempt's own run id (use with run_output).
task_keynot null VARCHAR
Task key within the job.
attempt_number BIGINT
Attempt number of the task, 0 for the first try; retries add rows.
task_type VARCHAR
notebook, spark_python, sql, pipeline, run_job, dbt, condition, ...
life_cycle_state VARCHAR
QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR, BLOCKED or WAITING_FOR_RETRY.
result_state VARCHAR
Outcome once terminated: SUCCESS, FAILED, TIMEDOUT, CANCELED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED, EXCLUDED, DISABLED, MAXIMUM_CONCURRENT_RUNS_REACHED; NULL while active.
state_message VARCHAR
Human-readable state description, e.g. the failure reason.
status VARCHAR
Newer status.state: BLOCKED, PENDING, QUEUED, RUNNING, TERMINATING, TERMINATED, WAITING.
termination_code VARCHAR
status.termination_details.code, e.g. SUCCESS, RUN_EXECUTION_ERROR.
termination_type VARCHAR
status.termination_details.type: SUCCESS, INTERNAL_ERROR, CLIENT_ERROR, CLOUD_FAILURE.
start_time TIMESTAMP WITH TIME ZONE
When the task attempt started.
end_time TIMESTAMP WITH TIME ZONE
When the task attempt ended.
queue_duration_seconds DOUBLE
Seconds queued.
setup_duration_seconds DOUBLE
Seconds spent on cluster setup.
execution_duration_seconds DOUBLE
Seconds spent executing.
cleanup_duration_seconds DOUBLE
Seconds spent cleaning up.
cluster_id VARCHAR
Cluster the attempt ran on (cluster_instance.cluster_id).
existing_cluster_id VARCHAR
All-purpose cluster the task is configured to use.
job_cluster_key VARCHAR
Job cluster the task is configured to use.
depends_on VARCHAR[]
Task keys this task depends on.
description VARCHAR
Task description.
run_page_url VARCHAR
Link to the task run in the workspace UI.
ConstraintsPRIMARY KEY (task_run_id) · FOREIGN KEY (run_id) REFERENCES job_runs(run_id)
Examples (2)

Tasks that needed retries

SELECT run_id, task_key, count(*) AS attempts
FROM databricks.main.job_run_tasks
GROUP BY ALL
HAVING count(*) > 1
ORDER BY attempts DESC;

Slowest task per job

SELECT job_id, task_key, max(execution_duration_seconds) AS worst_s
FROM databricks.main.job_run_tasks
WHERE result_state = 'SUCCESS'
GROUP BY ALL
ORDER BY worst_s DESC
LIMIT 10;
Link
job_runs 2 examples28 cols

Databricks job runs with state, trigger, timings and termination details.

Columns
run_idnot null BIGINT
Run id (unique in the workspace).
job_id BIGINT
Unique numeric identifier of the job the run belongs to; NULL for one-time submit runs.
run_name VARCHAR
Run name (the job name for job runs).
number_in_job BIGINT
Sequence number of this run among the job's runs.
original_attempt_run_id BIGINT
Unique numeric run identifier of the first attempt, for a retried single-task run.
attempt_number BIGINT
Retry count before this attempt: 0 for the first attempt, 1 for the first retry.
run_type VARCHAR
JOB_RUN, WORKFLOW_RUN (dbutils.notebook.run) or SUBMIT_RUN (runs/submit).
trigger VARCHAR
What started the run: PERIODIC, ONE_TIME, RETRY, RUN_JOB_TASK, FILE_ARRIVAL, TABLE, CONTINUOUS, ...
life_cycle_state VARCHAR
QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR, BLOCKED or WAITING_FOR_RETRY.
result_state VARCHAR
Outcome once terminated: SUCCESS, FAILED, TIMEDOUT, CANCELED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED, EXCLUDED, DISABLED, MAXIMUM_CONCURRENT_RUNS_REACHED; NULL while active.
state_message VARCHAR
Human-readable state description, e.g. the failure reason.
status VARCHAR
Newer status.state: BLOCKED, PENDING, QUEUED, RUNNING, TERMINATING, TERMINATED, WAITING.
termination_code VARCHAR
status.termination_details.code, e.g. SUCCESS, RUN_EXECUTION_ERROR.
termination_type VARCHAR
status.termination_details.type: SUCCESS, INTERNAL_ERROR, CLIENT_ERROR, CLOUD_FAILURE.
termination_message VARCHAR
status.termination_details.message.
user_cancelled_or_timedout BOOLEAN
True when a user cancelled the run or it timed out.
queue_reason VARCHAR
Why the run is queued, while it is.
creator_user_name VARCHAR
User who started the run.
start_time TIMESTAMP WITH TIME ZONE
When the run was created (includes queueing and cluster setup).
end_time TIMESTAMP WITH TIME ZONE
When the run ended; NULL while active.
queue_duration_seconds DOUBLE
Seconds spent queued.
setup_duration_seconds DOUBLE
Seconds spent setting up the cluster (single-task runs).
execution_duration_seconds DOUBLE
Seconds spent executing (single-task runs).
cleanup_duration_seconds DOUBLE
Seconds spent cleaning up (single-task runs).
run_duration_seconds DOUBLE
Total run duration in seconds (multi-task runs).
cluster_id VARCHAR
Cluster of a single-cluster run, when known.
job_parameters STRUCT("name" VARCHAR, "value" VARCHAR)[]
Job-level parameters of the run (secret-looking values masked).
run_page_url VARCHAR
Link to the run in the workspace UI.
ConstraintsPRIMARY KEY (run_id)
Examples (2)

Failed runs of one job in November 2026 (job_id and the start_time range are sent to the API)

SELECT run_id, start_time, state_message
FROM databricks.main.job_runs
WHERE job_id = 101 AND result_state = 'FAILED' AND start_time >= TIMESTAMPTZ '2026-11-01'
ORDER BY start_time;

Run outcomes and median duration per job

SELECT run_name, result_state, count(*) AS runs,
  median(run_duration_seconds) AS median_s
FROM databricks.main.job_runs
GROUP BY ALL
ORDER BY run_name, result_state;
Link
jobs 2 examples16 cols

Databricks Lakeflow Jobs: schedule or trigger, tasks, job clusters and tags.

Columns
job_idnot null BIGINT
Numeric identifier Databricks assigned to the job (unique).
name VARCHAR
Job name.
creator_user_name VARCHAR
User who created the job.
run_as_user_name VARCHAR
User or service principal the job runs as.
created_time TIMESTAMP WITH TIME ZONE
When the job was created.
schedule_cron VARCHAR
Quartz cron expression of the job's schedule, if scheduled.
schedule_timezone VARCHAR
Time zone id of the schedule, e.g. 'UTC'.
schedule_paused BOOLEAN
True when the schedule or trigger is paused.
trigger_type VARCHAR
How new runs start: periodic (cron), file_arrival, table_update, periodic_interval, continuous, or NULL (manual / API only).
max_concurrent_runs BIGINT
Maximum number of concurrent runs (count of runs).
timeout_seconds BIGINT
Job timeout in seconds; 0 means none.
tags MAP(VARCHAR, VARCHAR)
Job tags as a MAP(VARCHAR, VARCHAR).
task_count BIGINT
Number of tasks in the job.
tasks STRUCT of 7 fields[]
Task summary: task_key, task_type (notebook, spark_python, sql, pipeline, ...), depends_on, cluster (existing cluster id, job_cluster:<key> or serverless), max_retries, timeout_seconds, description.
STRUCT[] 7 fields
  • task_keyVARCHAR
  • task_typeVARCHAR
  • depends_onVARCHAR[]
  • clusterVARCHAR
  • max_retriesBIGINT
  • timeout_secondsBIGINT
  • descriptionVARCHAR
job_clusters STRUCT of 7 fields[]
Shared job clusters: key, Spark version, node type, fixed size or autoscale bounds (count of workers), policy.
STRUCT[] 7 fields
  • job_cluster_keyVARCHAR
  • spark_versionVARCHAR
  • node_type_idVARCHAR
  • num_workersBIGINT
  • autoscale_min_workersBIGINT
  • autoscale_max_workersBIGINT
  • policy_idVARCHAR
settings JSON
The full job settings (JSON); secret-looking parameter and Spark config values are masked '***'.
ConstraintsPRIMARY KEY (job_id)
Examples (2)

Scheduled jobs and their cron expressions

SELECT name, schedule_cron, schedule_timezone
FROM databricks.main.jobs
WHERE trigger_type = 'periodic' AND NOT schedule_paused
ORDER BY name;

Jobs per owning team tag

SELECT tags['team'] AS team, count(*) AS jobs
FROM databricks.main.jobs
GROUP BY team
ORDER BY jobs DESC;
Link
pipeline_events 1 example13 cols

Pipeline event log: progress, data quality, errors with exceptions.

Columns
pipeline_idnot null VARCHAR
Pipeline the event belongs to.
event_idnot null VARCHAR
Unique identifier of the event-log entry.
update_id VARCHAR
Update the event belongs to (joins pipeline_updates.update_id).
timestamp TIMESTAMP WITH TIME ZONE
When the event happened.
level VARCHAR
INFO, WARN, ERROR or METRICS.
event_type VARCHAR
e.g. create_update, update_progress, flow_progress, cluster_resources.
maturity_level VARCHAR
STABLE, EVOLVING or DEPRECATED (schema stability of details).
message VARCHAR
Human-readable message.
flow_name VARCHAR
Flow (table) the event concerns, if any.
dataset_name VARCHAR
Dataset the event concerns, if any.
error_fatal BOOLEAN
error.fatal: true when the error stopped the update.
error_exceptions STRUCT(class_name VARCHAR, message VARCHAR)[]
error.exceptions: class_name and message.
details JSON
Event details (JSON; shape depends on event_type).
ConstraintsPRIMARY KEY (event_id) · FOREIGN KEY (pipeline_id) REFERENCES pipelines(pipeline_id)
Example

Error events of one pipeline (pipeline_id and level are sent to the API)

SELECT timestamp, flow_name, message
FROM databricks.main.pipeline_events
WHERE pipeline_id = 'pl-orders-0001' AND level = 'ERROR'
ORDER BY timestamp;
Link
pipeline_updates 1 example10 cols

Pipeline updates (runs) with state, cause and refresh selection.

Columns
pipeline_idnot null VARCHAR
Pipeline the update belongs to.
update_idnot null VARCHAR
Unique identifier of one pipeline update (run).
state VARCHAR
QUEUED, CREATED, WAITING_FOR_RESOURCES, INITIALIZING, RESETTING, SETTING_UP_TABLES, RUNNING, STOPPING, COMPLETED, FAILED or CANCELED.
cause VARCHAR
Why it started: API_CALL, JOB_TASK, RETRY_ON_FAILURE, SCHEMA_CHANGE, SERVICE_UPGRADE, USER_ACTION.
creation_time TIMESTAMP WITH TIME ZONE
When the update was created.
full_refresh BOOLEAN
True for a full refresh of every table.
validate_only BOOLEAN
True for a validation-only update.
cluster_id VARCHAR
Cluster that ran the update.
refresh_selection VARCHAR[]
Tables refreshed, for a partial refresh.
full_refresh_selection VARCHAR[]
Tables fully refreshed, for a partial full refresh.
ConstraintsPRIMARY KEY (update_id) · FOREIGN KEY (pipeline_id) REFERENCES pipelines(pipeline_id)
Example

Update outcomes per pipeline

SELECT p.name, u.state, count(*) AS updates
FROM databricks.main.pipeline_updates u
JOIN databricks.main.pipelines p USING (pipeline_id)
GROUP BY ALL
ORDER BY p.name, u.state;
Link
pipelines 1 example10 cols

Lakeflow Declarative Pipelines (Delta Live Tables) with state, health and latest update.

Columns
pipeline_idnot null VARCHAR
Unique pipeline identifier (a UUID).
name VARCHAR
Pipeline name.
state VARCHAR
DEPLOYING, STARTING, RUNNING, STOPPING, DELETED, RECOVERING, FAILED, RESETTING, IDLE.
health VARCHAR
HEALTHY or UNHEALTHY.
cluster_id VARCHAR
Cluster currently running the pipeline, if any.
creator_user_name VARCHAR
User who created the pipeline.
run_as_user_name VARCHAR
User the pipeline runs as.
latest_update_id VARCHAR
Most recent update id.
latest_update_state VARCHAR
State of the most recent update.
latest_update_time TIMESTAMP WITH TIME ZONE
When the most recent update was created.
ConstraintsPRIMARY KEY (pipeline_id)
Example

Unhealthy pipelines

SELECT name, state, latest_update_state
FROM databricks.main.pipelines
WHERE health = 'UNHEALTHY'
ORDER BY name;
Link
query_history 2 examples21 cols

Databricks SQL query history with status, timings, rows and I/O metrics.

Columns
query_idnot null VARCHAR
Query (statement) id.
status VARCHAR
QUEUED, RUNNING, CANCELED, FAILED or FINISHED.
statement_type VARCHAR
SELECT, INSERT, MERGE, CREATE, ... .
query_text VARCHAR
The SQL text.
warehouse_id VARCHAR
Warehouse that ran it (joins sql_warehouses.warehouse_id).
user_id BIGINT
Unique numeric identifier of the workspace user who issued the query.
user_name VARCHAR
Email / name of the user who issued it.
executed_as_user_name VARCHAR
User the query ran as.
query_start_timenot null TIMESTAMP WITH TIME ZONE
When the query was received.
execution_end_time TIMESTAMP WITH TIME ZONE
When execution finished.
query_end_time TIMESTAMP WITH TIME ZONE
When the query ended (including result fetch).
duration_seconds DOUBLE
Total time in seconds.
rows_produced BIGINT
Count of rows returned or written.
error_message VARCHAR
Error, when the query failed.
is_final BOOLEAN
True when the record will not change any more.
compilation_time_seconds DOUBLE
metrics.compilation_time_ms in seconds.
execution_time_seconds DOUBLE
metrics.execution_time_ms in seconds.
read_bytes BIGINT
Data read, in bytes (metrics.read_bytes).
read_rows BIGINT
Count of rows read (metrics.rows_read_count).
spill_to_disk_bytes BIGINT
Data spilled to disk, in bytes.
result_from_cache BOOLEAN
metrics.result_from_cache.
ConstraintsPRIMARY KEY (query_id)
Examples (2)

Failed queries per warehouse in one day (time range and status are sent to the API)

SELECT w.name, count(*) AS failed
FROM databricks.main.query_history q
JOIN databricks.main.sql_warehouses w USING (warehouse_id)
WHERE q.status = 'FAILED' AND q.query_start_time >= TIMESTAMPTZ '2026-11-14' AND q.query_start_time < TIMESTAMPTZ '2026-11-15'
GROUP BY w.name
ORDER BY failed DESC;

Slowest statements per user

SELECT user_name, max(duration_seconds) AS slowest_s,
  sum(read_bytes) AS bytes_read
FROM databricks.main.query_history
WHERE status = 'FINISHED'
GROUP BY user_name
ORDER BY slowest_s DESC;
Link
repos 1 example7 cols

Git folders (Repos) in the workspace: remote URL, branch and commit.

Columns
repo_idnot null BIGINT
Repo (Git folder) id.
path VARCHAR
Workspace path, e.g. '/Repos/[email protected]/etl'.
url VARCHAR
Remote Git URL.
provider VARCHAR
gitHub, gitLab, azureDevOpsServices, bitbucketCloud, ...
branch VARCHAR
Checked-out branch.
head_commit_id VARCHAR
SHA of the checked-out commit.
sparse_checkout_patterns VARCHAR[]
Sparse checkout cone patterns, if any.
ConstraintsPRIMARY KEY (repo_id)
Example

Git folders not on main

SELECT path, url, branch
FROM databricks.main.repos
WHERE branch <> 'main'
ORDER BY path;
Link
secret_scopes 1 example4 cols

Secret scope names and backends. Secret values are never read.

Columns
scopenot null VARCHAR
Secret scope name.
backend_type VARCHAR
DATABRICKS or AZURE_KEYVAULT.
keyvault_resource_id VARCHAR
Azure Key Vault resource id, for Key Vault-backed scopes.
keyvault_dns_name VARCHAR
Azure Key Vault DNS name, for Key Vault-backed scopes.
ConstraintsPRIMARY KEY (scope)
Example

Secret scopes per backend

SELECT backend_type, list(scope ORDER BY scope) AS scopes
FROM databricks.main.secret_scopes
GROUP BY ALL
ORDER BY backend_type;
Link
sql_warehouses 1 example19 cols

Databricks SQL warehouses: size, type, scaling, state and health.

Columns
warehouse_idnot null VARCHAR
Unique SQL warehouse identifier (the httpPath suffix).
name VARCHAR
Warehouse name.
state VARCHAR
STARTING, RUNNING, STOPPING, STOPPED, DELETING or DELETED.
cluster_size VARCHAR
T-shirt size, e.g. '2X-Small', 'Medium'.
warehouse_type VARCHAR
PRO or CLASSIC.
enable_serverless_compute BOOLEAN
True for a serverless warehouse.
enable_photon BOOLEAN
True when Photon is enabled.
min_num_clusters BIGINT
Minimum clusters (scaling lower bound).
max_num_clusters BIGINT
Maximum clusters (scaling upper bound).
num_clusters BIGINT
Count of clusters currently running.
num_active_sessions BIGINT
Count of open sessions.
auto_stop_mins BIGINT
Idle time before the warehouse stops, in minutes; 0 = never.
spot_instance_policy VARCHAR
COST_OPTIMIZED or RELIABILITY_OPTIMIZED.
channel VARCHAR
Release channel: CHANNEL_NAME_CURRENT or CHANNEL_NAME_PREVIEW.
creator_name VARCHAR
User who created the warehouse.
health_status VARCHAR
health.status: HEALTHY, DEGRADED, FAILED.
health_summary VARCHAR
health.summary text.
custom_tags MAP(VARCHAR, VARCHAR)
User-defined tags.
jdbc_url VARCHAR
JDBC connection URL (contains no credentials).
ConstraintsPRIMARY KEY (warehouse_id)
Example

Warehouses by size and type

SELECT name, cluster_size, warehouse_type, enable_serverless_compute, state
FROM databricks.main.sql_warehouses
ORDER BY name;
Link
Table functions
run_output (run_id BIGINT, include_result := BOOLEAN, max_log_chars := BIGINT) 2 examples

Error, stack trace, logs and notebook exit metadata of every task of one Databricks job run

Positional arguments
run_id BIGINT
A job run id (every task's output) or one task run id.
Named arguments
include_result := BOOLEAN
Return the notebook exit value text. Default false: only its length and truncation flag. · default false
max_log_chars := BIGINT
Keep at most this many characters of logs and error_trace. · default 65536
Returns columns
run_id BIGINT
The run id you passed.
task_run_id BIGINT
Task run whose output this row holds.
task_key VARCHAR
Task key, for a task of a multi-task run.
attempt_number BIGINT
Attempt number of the task run, 0 for the first try.
life_cycle_state VARCHAR
Life-cycle state of the task run.
result_state VARCHAR
Result state of the task run, once terminated.
error VARCHAR
Error message, when the task failed.
error_trace VARCHAR
Error stack trace, cut to max_log_chars.
logs VARCHAR
stdout of the task (spark_python / python_wheel tasks), cut to max_log_chars.
logs_truncated BOOLEAN
True when Databricks or max_log_chars cut the logs or trace.
notebook_result VARCHAR
dbutils.notebook.exit() value; NULL unless include_result := true.
notebook_result_length BIGINT
Length in characters of the notebook exit value.
notebook_result_truncated BOOLEAN
True when Databricks truncated the exit value.
Examples (2)

Error messages of the failed tasks of one job run

SELECT task_key, attempt_number, error
FROM databricks.main.run_output(2002)
WHERE error IS NOT NULL
ORDER BY task_key;

Notebook exit values of the successful tasks of a run

SELECT task_key, notebook_result
FROM databricks.main.run_output(2101, include_result := true)
WHERE result_state = 'SUCCESS'
ORDER BY task_key;
Link
workspace_objects (path VARCHAR, recursive := BOOLEAN) 1 example

Notebooks, files, folders and Git folders under a Databricks workspace path

Positional arguments
path VARCHAR
Absolute workspace directory, e.g. '/Users/[email protected]' or '/'.
Named arguments
recursive := BOOLEAN
Descend into sub-directories and Git folders. Default false. · default false
Returns columns
path VARCHAR
Absolute workspace path of the object.
parent_path VARCHAR
Directory that was listed to find it.
object_type VARCHAR
NOTEBOOK, DIRECTORY, FILE, LIBRARY, REPO or DASHBOARD.
object_id BIGINT
Object id.
language VARCHAR
Notebook language: PYTHON, SQL, SCALA or R.
created_at TIMESTAMPTZ
When the object was created.
modified_at TIMESTAMPTZ
When the object was last modified.
size BIGINT
File size in bytes (files only).
resource_id VARCHAR
Unique resource id of the object.
Example

Notebooks per language under a user's home folder

SELECT language, count(*) AS notebooks
FROM databricks.main.workspace_objects('/Users/[email protected]', recursive := true)
WHERE object_type = 'NOTEBOOK'
GROUP BY language
ORDER BY notebooks DESC;
Link
unified 2 tables · 1 function

Job runs and task attempts in the cross-orchestrator shape shared by Query.Farm workers.

Schema examples (3)
Examples (3)

Runs per status

SELECT status, count(*) AS runs
FROM databricks.unified.runs
GROUP BY status
ORDER BY status;

Task outcomes joined to their runs

SELECT r.pipeline, t.status, count(*) AS tasks
FROM databricks.unified.task_runs t
JOIN databricks.unified.runs r USING (run_id)
GROUP BY ALL
ORDER BY r.pipeline, t.status;

Task attempts per unified status

SELECT databricks.unified.unified_status(coalesce(result_state, life_cycle_state)) AS status,
  count(*) AS tasks
FROM databricks.main.job_run_tasks
GROUP BY ALL
ORDER BY status;
Tables
runs 2 examples11 cols

Databricks job runs in the cross-orchestrator unified.runs shape.

Columns
orchestratornot null VARCHAR
Always 'databricks'.
run_idnot null VARCHAR
Jobs run id as text (unique in the workspace).
pipeline VARCHAR
Run name: the job's name when the run started (or the submit-run name).
statusnot null VARCHAR
queued, running, success, failed, cancelled or skipped.
raw_status VARCHAR
Databricks result_state once terminated, else life_cycle_state.
trigger VARCHAR
schedule (cron / continuous), manual (run now), sensor (file arrival), api (runs/submit), event (table update), other (retry, run-job task).
queued_at TIMESTAMP WITH TIME ZONE
When the run was created (Databricks start_time).
started_at TIMESTAMP WITH TIME ZONE
Databricks start_time (includes queueing and cluster setup).
ended_at TIMESTAMP WITH TIME ZONE
When the run ended; NULL while active.
duration_seconds DOUBLE
ended_at - started_at in seconds.
url VARCHAR
Link to the run in the workspace UI.
ConstraintsPRIMARY KEY (run_id)
Examples (2)

Runs per status

SELECT status, count(*) AS runs
FROM databricks.unified.runs
GROUP BY status
ORDER BY status;

Failure rate per pipeline since November

SELECT pipeline, avg((status = 'failed')::INT) AS failure_rate
FROM databricks.unified.runs
WHERE started_at >= TIMESTAMPTZ '2026-11-01'
GROUP BY pipeline
ORDER BY failure_rate DESC;
Link
task_runs 1 example11 cols

Databricks task attempts in the cross-orchestrator unified.task_runs shape.

Columns
orchestratornot null VARCHAR
Always 'databricks'.
run_idnot null VARCHAR
Parent job run id as text; joins unified.runs.run_id.
task_run_idnot null VARCHAR
This task attempt's own run id as text.
task_name VARCHAR
Task key.
statusnot null VARCHAR
queued, running, success, failed, cancelled or skipped.
raw_status VARCHAR
Databricks result_state once terminated, else life_cycle_state.
attempt INTEGER
1-based attempt (Databricks attempt_number + 1); retries add rows.
started_at TIMESTAMP WITH TIME ZONE
When the attempt started.
ended_at TIMESTAMP WITH TIME ZONE
When the attempt ended.
duration_seconds DOUBLE
ended_at - started_at in seconds.
url VARCHAR
Link to the task run in the workspace UI.
ConstraintsPRIMARY KEY (task_run_id) · FOREIGN KEY (run_id) REFERENCES runs(run_id)
Example

Task outcomes joined to their runs

SELECT r.pipeline, t.status, count(*) AS tasks
FROM databricks.unified.task_runs t
JOIN databricks.unified.runs r USING (run_id)
GROUP BY ALL
ORDER BY r.pipeline, t.status;
Link
Scalar functions
unified_status (state VARCHAR) 3 examples

Map a Databricks Jobs run or task state onto queued/running/success/failed/cancelled/skipped

Arguments
state VARCHAR
A Databricks Jobs result_state (SUCCESS, FAILED, CANCELED, UPSTREAM_FAILED, ...) or, for a run that has not terminated, its life_cycle_state (QUEUED, PENDING, RUNNING, ...). Case-insensitive; NULL maps to queued.
ReturnsVARCHAR
Examples (3)

Task attempts per unified status

SELECT databricks.unified.unified_status(coalesce(result_state, life_cycle_state)) AS status,
  count(*) AS tasks
FROM databricks.main.job_run_tasks
GROUP BY ALL
ORDER BY status;
SELECT s AS state, databricks.unified.unified_status(s) AS status
FROM (VALUES ('SUCCESS'), ('FAILED'), ('UPSTREAM_FAILED'), ('CANCELED'), ('RUNNING'), ('WAITING_FOR_RETRY')) t(s)
ORDER BY s;
SELECT databricks.unified.unified_status(NULL::VARCHAR) AS status;
Link

Credentials

The secret type databricks declares, as reported by the worker itself.

databricks

How to get these credentials

Connection to one Databricks workspace's REST API (AWS, Azure or GCP): the workspace URL plus a personal access token, an OAuth service principal (client id + secret), or an Azure AD token.

secret.sql
CREATE SECRET databricks (
    TYPE databricks,
    host          '<host>',  -- required
    token         '<DATABRICKS_TOKEN>',  -- secret
    client_id     '<client_id>',
    client_secret '<DATABRICKS_CLIENT_SECRET>',  -- secret
    azure_token   '<AZURE_TOKEN>',  -- secret
    auth_type     '<auth_type>',
    page_size     '<page_size>',
    timeout       '<timeout>'
);
Key Type Required Description
host VARCHAR Yes Workspace URL, e.g. 'https://dbc-a1b2c3d4-e5f6.cloud.databricks.com' or 'https://adb-1234567890123456.7.azuredatabricks.net'.
token secret VARCHAR No Personal access token (dapi...), sent as a bearer token.
client_id VARCHAR No OAuth M2M: the service principal's application (client) id.
client_secret secret VARCHAR No OAuth M2M: the service principal's OAuth secret, exchanged at <host>/oidc/v1/token.
azure_token secret VARCHAR No An Azure AD (Entra ID) access token for the Azure Databricks resource.
auth_type VARCHAR No 'auto' (default: token, then client_id/client_secret, then azure_token), 'pat', 'oauth-m2m' or 'azure'.
page_size BIGINT No Items requested per API page, capped at each endpoint's maximum.
timeout DOUBLE No Per-request timeout in seconds (default 30).

Needed by run_outputworkspace_objects

Create the secret in the same session, after attaching databricks — the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

Failed runs of one job in November 2026 (job_id and the start_time range are sent to the API)

SELECT run_id, start_time, state_message
FROM databricks.main.job_runs
WHERE job_id = 101 AND result_state = 'FAILED' AND start_time >= TIMESTAMPTZ '2026-11-01'
ORDER BY start_time

Uses job_runs

Tasks that needed retries

SELECT run_id, task_key, count(*) AS attempts
FROM databricks.main.job_run_tasks
GROUP BY ALL
HAVING count(*) > 1
ORDER BY attempts DESC

Uses job_run_tasks

Running clusters and their owners (state is sent to the API)

SELECT cluster_name, creator_user_name, spark_version, num_workers
FROM databricks.main.clusters
WHERE state = 'RUNNING'
ORDER BY cluster_name

Uses clusters

Resize and termination events of one cluster

SELECT timestamp, type, current_num_workers, target_num_workers, reason_code
FROM databricks.main.cluster_events
WHERE cluster_id = '0915-120000-shared01' AND type IN ('RESIZING', 'TERMINATING')
ORDER BY timestamp

Uses cluster_events

Pool utilisation

SELECT instance_pool_name, used_count, idle_count, max_capacity
FROM databricks.main.instance_pools
ORDER BY instance_pool_name

Uses instance_pools

Warehouses by size and type

SELECT name, cluster_size, warehouse_type, enable_serverless_compute, state
FROM databricks.main.sql_warehouses
ORDER BY name

Uses sql_warehouses

21 more examples in the Catalog, each listed under the table or function it uses.

Questions it can answer

Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.

  • Using the databricks catalog, which job runs failed? Give the run id and the run name.
  • Using the databricks catalog, which task needed more than one attempt, in which run, and how many attempts?
  • Using the databricks catalog's unified schema, how many runs are there per status?
  • Using the databricks catalog, which jobs run on a cron schedule, and what is each cron expression?
  • Using the databricks catalog, which tasks never ran because an upstream task failed? Give the run id and task key.
  • Using the databricks catalog, what error message did the failed 'transform' task of run 2002 report?

Databricks is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.