MD_GET_FLIGHT_LOGS
Preview
This feature is in preview and is subject to change.
Returns the captured logs for a single Flight run. The output combines stdout and stderr in the order the runtime captured them.
Syntax
SELECT logs FROM MD_GET_FLIGHT_LOGS(
flight_id := '<flight_id>',
run_number := <n>
);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
flight_id | UUID | Yes | Identifier of the Flight. |
run_number | INTEGER | Yes | The run number to fetch logs for. |
Return columns
| Column | Type | Description |
|---|---|---|
logs | VARCHAR | The full combined stdout/stderr captured during the run. |
Behavior
- Returns an error when no run with the given
run_numberexists for the Flight, or when the Flight itself doesn't exist. - Available for runs in any terminal status (
SUCCEEDED,FAILED,CANCELLED) and during aRUNNINGrun. - Parameters must be literals or
getvariable()calls. Subqueries and lateral join columns fail with a binder error; store dynamic values withSET VARIABLEfirst. - Pass arguments by name. The signature order is
MD_GET_FLIGHT_LOGS(flight_id, run_number)—flight_idfirst, thenrun_number.
Examples
Read the latest run's logs:
SET VARIABLE latest_run_number = (
SELECT max(run_number)
FROM MD_LIST_FLIGHT_RUNS(flight_id := '<flight_id>')
);
SELECT logs
FROM MD_GET_FLIGHT_LOGS(
flight_id := '<flight_id>',
run_number := getvariable('latest_run_number')
);
Read a specific run:
SELECT logs
FROM MD_GET_FLIGHT_LOGS(
flight_id := '80000000-0000-0000-0000-000000000001',
run_number := 42
);
Related
MD_LIST_FLIGHT_RUNS— Find the run number to read logs for.MD_RUN_FLIGHT— Trigger an on-demand run.get_flight_run_logsMCP tool — AI-agent equivalent, with amax_bytescap.