MD_LIST_FLIGHT_RUNS
Preview
This feature is in preview and is subject to change.
Returns every run of a single Flight. Each row has a status, a sequential run number, and the version of the Flight that ran.
Syntax
SELECT * FROM MD_LIST_FLIGHT_RUNS(
flight_id := '<flight_id>',
"LIMIT" := <n>,
"OFFSET" := <n>
);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
flight_id | UUID | Yes | Identifier of the Flight. |
LIMIT | BIGINT | No | Maximum number of runs to return. |
OFFSET | BIGINT | No | Skip this many runs before returning. |
LIMIT and OFFSET are SQL keywords and must be quoted when used as named arguments.
Return columns
| Column | Type | Description |
|---|---|---|
run_id | UUID | Unique identifier of the run. |
flight_id | UUID | Flight identifier. |
flight_name | VARCHAR | Flight name at the time of the run. |
flight_version | INTEGER | The version this run locked to at start. |
config | MAP(VARCHAR, VARCHAR) | The config the run used, including any per-run overrides passed to MD_RUN_FLIGHT. |
run_number | INTEGER | Sequential run number, starting at 1. |
is_scheduled | BOOLEAN | true if the run was triggered by the schedule, false for on-demand. |
status | VARCHAR | Run status: RUN_STATUS_PENDING, RUN_STATUS_RUNNING, RUN_STATUS_SUCCEEDED, RUN_STATUS_FAILED, or RUN_STATUS_CANCELLED. |
created_at | TIMESTAMP WITH TIME ZONE | When the run was created. |
started_at | TIMESTAMP WITH TIME ZONE | When the run started executing, or NULL if it hasn't started. |
ended_at | TIMESTAMP WITH TIME ZONE | When the run finished, or NULL while it's still running. |
scheduled_at | TIMESTAMP WITH TIME ZONE | When the run was scheduled. |
cancelled_at | TIMESTAMP WITH TIME ZONE | When the run was cancelled, or NULL. |
exit_code | INTEGER | Process exit code, or NULL while the run is in progress. 0 means success. |
A Flight created before per-run config overrides shipped may report empty strings for config until you update the Flight once, which redeploys it.
Examples
Latest 10 runs, newest first, with the config each run used:
SELECT run_number, status, flight_version, config, created_at
FROM MD_LIST_FLIGHT_RUNS(flight_id := '<flight_id>')
ORDER BY run_number DESC
LIMIT 10;
Find recent failures:
SELECT run_number, flight_version, created_at
FROM MD_LIST_FLIGHT_RUNS(flight_id := '<flight_id>')
WHERE status = 'RUN_STATUS_FAILED'
ORDER BY run_number DESC;
Total runs per version:
SELECT flight_version, COUNT(*) AS runs
FROM MD_LIST_FLIGHT_RUNS(flight_id := '<flight_id>')
GROUP BY flight_version
ORDER BY flight_version DESC;
Related
MD_RUN_FLIGHT— Trigger an on-demand run.MD_GET_FLIGHT_LOGS— Read a specific run's output.MD_CANCEL_FLIGHT_RUN— Cancel an in-progress run.list_flight_runsMCP tool — AI-agent equivalent.