Skip to main content

MD_GET_FLIGHT_RUN

Preview
This feature is in preview and is subject to change.

Returns one run of a Flight, looked up directly by run_number. Use it to check a specific run's status without paging through MD_LIST_FLIGHT_RUNS.

Syntax

SELECT * FROM MD_GET_FLIGHT_RUN(
flight_id := '<flight_id>',
run_number := <n>
);

Parameters

ParameterTypeRequiredDescription
flight_idUUIDYesIdentifier of the Flight.
run_numberUBIGINTYesThe run to fetch. Run numbers are sequential, starting at 1.

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.

Behavior

  • Returns an error when no run with the given run_number exists for the Flight, or when the Flight itself doesn't exist.
  • Parameters must be literals or getvariable() calls. Subqueries and lateral join columns fail with a binder error; store dynamic values with SET VARIABLE first.

Examples

Check a specific run:

SELECT status, exit_code, started_at, ended_at
FROM MD_GET_FLIGHT_RUN(
flight_id := '80000000-0000-0000-0000-000000000001',
run_number := 42
);

Poll the run you just triggered:

SET VARIABLE run_number = (
SELECT run_number
FROM MD_RUN_FLIGHT(flight_id := '<flight_id>')
);

SELECT status, exit_code
FROM MD_GET_FLIGHT_RUN(
flight_id := '<flight_id>',
run_number := getvariable('run_number')
);