Skip to main content

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

ParameterTypeRequiredDescription
flight_idUUIDYesIdentifier of the Flight.
LIMITBIGINTNoMaximum number of runs to return.
OFFSETBIGINTNoSkip 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_versionINTEGERThe 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_numberINTEGERSequential 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.

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;