Skip to content

update

gapline update <target> -w QUERY -s KEY=VALUE [KEY=VALUE...] [-f PATH] [--confirm] [--cascade] [-o PATH]

update rewrites fields on every record matching --where. Both the filter and the --set pairs are mandatory — there is no way to do a blanket update.

When a --set assignment changes a primary key (for example, renaming a stop_id), gapline detects the PK change and, if --cascade is passed, rewrites every foreign-key reference in dependent files (e.g. stop_times.txt for a stop_id rename). Without --cascade, a PK reassignment that would orphan dependents is refused.

Non-PK updates never cascade: they touch only the target file. Use --confirm to skip the interactive prompt in scripts and CI.

ArgumentValues
<target>Any GTFS file supported for CRUD — see read for the complete list of 17 values.
FlagShortValueDescription
--feed-fPATHPath to the GTFS feed. Optional when [default] feed is set in a config file.
--where-wQUERYRequired. Filter expression selecting the records to update. See the query language.
--set-sKEY=VALUERequired. Field values to apply to every matched record. Accepts multiple KEY=VALUE pairs after a single --set flag.
--confirmSkip the interactive confirmation prompt.
--cascadeCascade primary-key changes to every dependent file. Required when --set rewrites a PK that other files reference.
--output-oPATHWrite the modified feed to this path instead of overwriting the source.

Global flags are listed on reference/global-flags.

Terminal window
gapline update stops -f gtfs.zip \
--where "stop_id=S01" \
--set stop_name="Gare Centrale" \
--confirm

No cascade is needed: stop_name is not a primary key.

Terminal window
gapline update stops -f gtfs.zip \
--where "stop_id=S01" \
--set stop_id=STOP_MAIN \
--cascade --confirm

Every row in stop_times.txt, transfers.txt, pathways.txt, and any other file that references stop_id=S01 is rewritten in the same pass.

Terminal window
gapline update routes -f gtfs.zip \
--where "route_id=R1" \
--set route_short_name="1" route_long_name="Boulevard" route_type=3 \
--confirm
Terminal window
gapline update routes -f gtfs.zip \
--where "route_type=700" \
--set route_type=3 \
--confirm
CodeMeaning
0Records updated successfully.
1--where could not be parsed, no records matched, or a PK reassignment was refused without --cascade.
2Configuration error.
3I/O error (feed not found, output path unwritable).
4--where matched zero records. Nothing was written.

See concepts/exit-codes for the complete table.