Skip to main content

MD_LIST_FLIGHT_RUNS

Returns every run of a single Flight. Each row has a status, a sequential run number, and the version of the Flight that ran.

Only the Flight's owner and organization Admins can list its runs. Someone with a run grant gets Only a Flight's owner and the admins of its organization can list its runs. With run access, you can get a run you started by its number. and reads their runs one at a time with MD_GET_FLIGHT_RUN.

Syntax​

SELECT * FROM MD_LIST_FLIGHT_RUNS(
flight_id := '<flight_id>',
"LIMIT" := <n>,
"OFFSET" := <n>
);

Parameters​

ParameterTypeRequiredDefaultDescription
flight_idUUIDYesIdentifier of the Flight.
LIMITUINTEGERNo50Maximum number of runs to return.
OFFSETUINTEGERNo0Skip this many runs before returning.

LIMIT and OFFSET are SQL keywords and must be quoted when used as named arguments.

Return columns​

ColumnTypeDescription
run_idUUIDUnique identifier of the run.
flight_idUUIDFlight identifier.
flight_nameVARCHARFlight name at the time of the run.
flight_versionUINTEGERThe version this run locked to at start.
configMAP(VARCHAR, VARCHAR)The config the run used, including any per-run overrides passed to MD_RUN_FLIGHT.
run_numberUBIGINTSequential run number, starting at 1.
is_scheduledBOOLEANtrue if the run was triggered by the schedule, false for on-demand.
statusVARCHARRun status: RUN_STATUS_PENDING, RUN_STATUS_RUNNING, RUN_STATUS_SUCCEEDED, RUN_STATUS_FAILED, or RUN_STATUS_CANCELLED.
created_atTIMESTAMP WITH TIME ZONEWhen the run was created.
started_atTIMESTAMP WITH TIME ZONEWhen the run started executing, or NULL if it hasn't started.
ended_atTIMESTAMP WITH TIME ZONEWhen the run finished, or NULL while it's still running.
scheduled_atTIMESTAMP WITH TIME ZONEWhen the run was scheduled.
cancelled_atTIMESTAMP WITH TIME ZONEWhen the run was cancelled, or NULL.
exit_codeINTEGERProcess exit code, or NULL while the run is in progress. 0 means success.
started_by_idUUIDWho started the run. NULL for scheduled runs and for runs started before this column existed. Requires a MotherDuck client extension released on October 23, 2026 or later.
started_by_nameVARCHARThe username of who started the run. NULL when started_by_id is, or once that user no longer exists. Requires a MotherDuck client extension released on October 23, 2026 or later.

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;