AACFlow

Databricks

Run SQL queries and manage jobs on Databricks

Usage Instructions

Connect to Databricks to execute SQL queries against SQL warehouses, trigger and monitor job runs, manage clusters, and retrieve run outputs. Requires a Personal Access Token and workspace host URL.

Tools

databricks_execute_sql

Execute a SQL statement against a Databricks SQL warehouse and return results inline. Supports parameterized queries and Unity Catalog.

Input

ParameterTypeRequiredDescription
hoststringYesNo description
apiKeystringYesNo description
warehouseIdstringYesNo description
statementstringYesNo description
catalogstringNoNo description
schemastringNoNo description
rowLimitnumberNoNo description
waitTimeoutstringNoHow long to wait for results (e.g., "50s"). Range: "0s" or "5s" to "50s". Default: "50s"

Output

ParameterTypeDescription
statementIdstringUnique identifier for the executed statement
statusstringExecution status (SUCCEEDED, PENDING, RUNNING, FAILED, CANCELED, CLOSED)
columnsarrayColumn schema of the result set
namestringColumn name
positionnumberColumn position (0-based)
typeNamestringColumn type (STRING, INT, LONG, DOUBLE, BOOLEAN, TIMESTAMP, DATE, DECIMAL, etc.)
dataarrayResult rows as a 2D array of strings where each inner array is a row of column values
totalRowsnumberTotal number of rows in the result
truncatedbooleanWhether the result set was truncated due to row_limit or byte_limit

databricks_list_jobs

Input

ParameterTypeRequiredDescription
hoststringYesNo description
apiKeystringYesNo description
limitnumberNoNo description
offsetnumberNoNo description
namestringNoNo description
expandTasksbooleanNoNo description

Output

ParameterTypeDescription
jobsarrayList of jobs in the workspace
jobIdnumberUnique job identifier
namestringJob name
createdTimenumberJob creation timestamp (epoch ms)
creatorUserNamestringEmail of the job creator
maxConcurrentRunsnumberMaximum number of concurrent runs
formatstringJob format (SINGLE_TASK or MULTI_TASK)
hasMorebooleanWhether more jobs are available for pagination
nextPageTokenstringToken for fetching the next page of results

databricks_run_job

Trigger an existing Databricks job to run immediately with optional job-level or notebook parameters.

Input

ParameterTypeRequiredDescription
hoststringYesNo description
apiKeystringYesNo description
jobIdnumberYesNo description
jobParametersstringNoJob-level parameter overrides as a JSON object (e.g., {"key": "value"})
notebookParamsstringNoNotebook task parameters as a JSON object (e.g., {"param1": "value1"})
idempotencyTokenstringNoNo description

Output

ParameterTypeDescription
runIdnumberThe globally unique ID of the triggered run
numberInJobnumberThe sequence number of this run among all runs of the job

databricks_get_run

Input

ParameterTypeRequiredDescription
hoststringYesNo description
apiKeystringYesNo description
runIdnumberYesNo description
includeHistorybooleanNoNo description
includeResolvedValuesbooleanNoNo description

Output

ParameterTypeDescription
runIdnumberThe run ID
jobIdnumberThe job ID this run belongs to
runNamestringName of the run
runTypestringType of run (JOB_RUN, WORKFLOW_RUN, SUBMIT_RUN)
attemptNumbernumberRetry attempt number (0 for initial attempt)
stateobjectRun state information
lifeCycleStatestringLifecycle state (QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR, BLOCKED, WAITING_FOR_RETRY)
resultStatestringResult state (SUCCESS, FAILED, TIMEDOUT, CANCELED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED, EXCLUDED)
stateMessagestringDescriptive message for the current state
userCancelledOrTimedoutbooleanWhether the run was cancelled by user or timed out
startTimenumberRun start timestamp (epoch ms)
endTimenumberRun end timestamp (epoch ms, 0 if still running)
setupDurationnumberCluster setup duration (ms)
executionDurationnumberExecution duration (ms)
cleanupDurationnumberCleanup duration (ms)
queueDurationnumberTime spent in queue before execution (ms)
runPageUrlstringURL to the run detail page in Databricks UI
creatorUserNamestringEmail of the user who triggered the run

databricks_list_runs

List job runs in a Databricks workspace with optional filtering by job, status, and time range.

Input

ParameterTypeRequiredDescription
hoststringYesNo description
apiKeystringYesNo description
jobIdnumberNoNo description
activeOnlybooleanNoNo description
completedOnlybooleanNoNo description
limitnumberNoNo description
offsetnumberNoNo description
runTypestringNoNo description
startTimeFromnumberNoNo description
startTimeTonumberNoNo description

Output

ParameterTypeDescription
runsarrayList of job runs
runIdnumberUnique run identifier
jobIdnumberJob this run belongs to
runNamestringRun name
runTypestringRun type (JOB_RUN, WORKFLOW_RUN, SUBMIT_RUN)
stateobjectRun state information
lifeCycleStatestringLifecycle state (QUEUED, PENDING, RUNNING, TERMINATING, TERMINATED, SKIPPED, INTERNAL_ERROR, BLOCKED, WAITING_FOR_RETRY)
resultStatestringResult state (SUCCESS, FAILED, TIMEDOUT, CANCELED, SUCCESS_WITH_FAILURES, UPSTREAM_FAILED, UPSTREAM_CANCELED, EXCLUDED)
stateMessagestringDescriptive state message
userCancelledOrTimedoutbooleanWhether the run was cancelled by user or timed out
startTimenumberRun start timestamp (epoch ms)
endTimenumberRun end timestamp (epoch ms)
hasMorebooleanWhether more runs are available for pagination
nextPageTokenstringToken for fetching the next page of results

databricks_cancel_run

Cancel a running or pending Databricks job run. Cancellation is asynchronous; poll the run status to confirm termination.

Input

ParameterTypeRequiredDescription
hoststringYesNo description
apiKeystringYesNo description
runIdnumberYesNo description

Output

ParameterTypeDescription
successbooleanWhether the cancel request was accepted

databricks_get_run_output

Get the output of a completed Databricks job run, including notebook results, error messages, and logs. For multi-task jobs, use the task run ID (not the parent run ID).

Input

ParameterTypeRequiredDescription
hoststringYesNo description
apiKeystringYesNo description
runIdnumberYesNo description

Output

ParameterTypeDescription
notebookOutputobjectNotebook task output (from dbutils.notebook.exit())
resultstringValue passed to dbutils.notebook.exit() (max 5 MB)
truncatedbooleanWhether the result was truncated
errorstringError message if the run failed or output is unavailable
errorTracestringError stack trace if available
logsstringLog output (last 5 MB) from spark_jar, spark_python, or python_wheel tasks
logsTruncatedbooleanWhether the log output was truncated

databricks_list_clusters

List all clusters in a Databricks workspace including their state, configuration, and resource details.

Input

ParameterTypeRequiredDescription
hoststringYesNo description
apiKeystringYesNo description

Output

ParameterTypeDescription
clustersarrayList of clusters in the workspace
clusterIdstringUnique cluster identifier
clusterNamestringCluster display name
statestringCurrent state (PENDING, RUNNING, RESTARTING, RESIZING, TERMINATING, TERMINATED, ERROR, UNKNOWN)
stateMessagestringHuman-readable state description
creatorUserNamestringEmail of the cluster creator
sparkVersionstringSpark runtime version (e.g., 13.3.x-scala2.12)
nodeTypeIdstringWorker node type identifier
driverNodeTypeIdstringDriver node type identifier
numWorkersnumberNumber of worker nodes (for fixed-size clusters)
autoscaleobjectAutoscaling configuration (null for fixed-size clusters)
minWorkersnumberMinimum number of workers
maxWorkersnumberMaximum number of workers
clusterSourcestringOrigin (API, UI, JOB, MODELS, PIPELINE, PIPELINE_MAINTENANCE, SQL)
autoterminationMinutesnumberMinutes of inactivity before auto-termination (0 = disabled)
startTimenumberCluster start timestamp (epoch ms)

On this page

Start building today
Trusted by over 100,000 builders.
The SaaS platform to build AI agents and run your agentic workforce.
Get started