Skip to main content

MD_LIST_FLIGHTS

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

Returns the summary metadata for every Flight the caller can see: Users can see Flights they have created. Admins can see Flights they own as well as any Flight in the organization. Use the optional LIMIT and OFFSET parameters to page through large result sets.

Syntax

SELECT * FROM MD_LIST_FLIGHTS(
"LIMIT" := <n>,
"OFFSET" := <n>,
owner_only := <boolean>
);

Parameters

ParameterTypeRequiredDefaultDescription
LIMITUINTEGERNo50Maximum number of Flights to return.
OFFSETUINTEGERNo0Skip this many Flights before returning.
owner_onlyBOOLEANNofalseReturn only the Flights you own. Meaningful for Admins, who otherwise see the whole organization; for other users the result is the same either way.

LIMIT and OFFSET collide with SQL keywords and must be quoted with double quotes when passed as named arguments.

Return columns

ColumnTypeDescription
flight_idUUIDFlight identifier.
flight_nameVARCHARThe Flight name.
schedule_cronVARCHARCron expression, or NULL for on-demand.
schedule_statusVARCHARSchedule state (for example, SCHEDULE_STATUS_ACTIVE or SCHEDULE_STATUS_DISABLED), or NULL when the Flight has no schedule.
statusVARCHARFlight status (for example, JOB_STATUS_ACTIVE). Not the schedule state — see schedule_status.
current_versionUINTEGERLatest version number.
created_atTIMESTAMP WITH TIME ZONECreation timestamp.
updated_atTIMESTAMP WITH TIME ZONELast update timestamp.
owner_nameVARCHARThe user who owns the Flight.

Version-specific content (source_code, requirements_txt, config) is not on this row; query MD_GET_FLIGHT_VERSION when you need it.

note

The name column is flight_name, not name. Filter and project with flight_name (for example, WHERE flight_name = 'hourly_metrics').

Examples

List all Flights:

SELECT flight_id, flight_name, schedule_cron, current_version
FROM MD_LIST_FLIGHTS();

Page through results:

SELECT flight_name
FROM MD_LIST_FLIGHTS("LIMIT" := 50, "OFFSET" := 100);

Find Flights with active schedules:

SELECT flight_name, schedule_cron
FROM MD_LIST_FLIGHTS()
WHERE schedule_cron IS NOT NULL;

As an Admin, group the organization's Flights by owner:

SELECT owner_name, count(*) AS flights
FROM MD_LIST_FLIGHTS()
GROUP BY owner_name
ORDER BY flights DESC;

Narrow the listing back to the Flights you own:

SELECT flight_name
FROM MD_LIST_FLIGHTS(owner_only := true);