Skip to main content

MD_UPDATE_FLIGHT

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

Updates an existing Flight. Behaves as a PATCH: only the parameters you pass are modified, and unspecified fields are left unchanged.

Updates to source_code, requirements_txt, config, access_token_name, or flight_secret_names produce a fresh FlightVersion. Updates to name or schedule_cron are metadata-only and do not bump the version.

You are responsible for the code you run and the packages it installs. Flights does not scan customer code or dependencies. Avoid untrusted packages, pin dependency versions, and treat dependency installs as a supply-chain risk.

Syntax

CALL MD_UPDATE_FLIGHT(
flight_id := '<flight_id>',
name := '<updated_name>',
schedule_cron := '0 0 * * *',
source_code := '<updated_python>',
requirements_txt := '<updated_requirements>',
config := MAP {'KEY': 'value'},
access_token_name := '<updated_token_name>',
flight_secret_names := ['secret_name']
);

Parameters

ParameterTypeRequiredDescription
flight_idUUIDYesIdentifier of the Flight to update.
nameVARCHARNoNew Flight name. Must be non-empty when provided. Metadata-only.
schedule_cronVARCHARNoNew cron expression (UTC, 5 fields). Pass '' (empty string) to clear the schedule. Metadata-only.
source_codeVARCHARNoNew Python source. Bumps the version.
requirements_txtVARCHARNoNew requirements.txt contents. Bumps the version.
configMAP(VARCHAR, VARCHAR)NoReplacement config map (full replace, not merge). Bumps the version.
access_token_nameVARCHARNoNew access token label. Bumps the version.
flight_secret_namesLIST(VARCHAR)NoReplacement list of Flight secret names (full replace). Bumps the version.

At least one of the above (besides flight_id) must be set.

Return columns

MD_UPDATE_FLIGHT returns the updated FlightSummary:

ColumnTypeDescription
flight_idUUIDThe Flight identifier.
flight_nameVARCHARThe current name.
schedule_cronVARCHARThe current cron expression, or NULL.
statusVARCHARSchedule status.
current_versionINTEGERThe current version (incremented for content updates).
created_atTIMESTAMP WITH TIME ZONEOriginal creation timestamp.
updated_atTIMESTAMP WITH TIME ZONEMost recent update timestamp.

Behavior

  • Full-replace semantics. config and flight_secret_names are replaced, not merged. To change one entry, send the full updated map or list.
  • Carry-forward semantics. When you patch one content field, the resulting version carries unchanged content fields forward from the previous version.
  • Empty schedule. schedule_cron := '' clears the schedule; omit it to leave the existing schedule untouched. Passing schedule_cron := '' to a Flight that already has no schedule returns an error, so only send it when there's a schedule to clear.
  • Definition size limit. source_code is capped at 200 KB and requirements_txt at 20 KB. Load large reference data from object storage at run time instead of embedding it in the source.

Examples

Rename a Flight (metadata-only, no new version):

CALL MD_UPDATE_FLIGHT(
flight_id := '<flight_id>',
name := 'analytics_hourly_sync'
);

Update the source (bumps the version):

CALL MD_UPDATE_FLIGHT(
flight_id := '<flight_id>',
source_code := $$
def main():
print("v2")

if __name__ == "__main__":
main()
$$
);

Clear the schedule, leave everything else:

CALL MD_UPDATE_FLIGHT(
flight_id := '<flight_id>',
schedule_cron := ''
);