update
Synopsis
Section titled “Synopsis”gapline update <target> -w QUERY -s KEY=VALUE [KEY=VALUE...] [-f PATH] [--confirm] [--cascade] [-o PATH]Description
Section titled “Description”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.
Arguments
Section titled “Arguments”| Argument | Values |
|---|---|
<target> | Any GTFS file supported for CRUD — see read for the complete list of 17 values. |
Options
Section titled “Options”| Flag | Short | Value | Description |
|---|---|---|---|
--feed | -f | PATH | Path to the GTFS feed. Optional when [default] feed is set in a config file. |
--where | -w | QUERY | Required. Filter expression selecting the records to update. See the query language. |
--set | -s | KEY=VALUE | Required. Field values to apply to every matched record. Accepts multiple KEY=VALUE pairs after a single --set flag. |
--confirm | Skip the interactive confirmation prompt. | ||
--cascade | Cascade primary-key changes to every dependent file. Required when --set rewrites a PK that other files reference. | ||
--output | -o | PATH | Write the modified feed to this path instead of overwriting the source. |
Global flags are listed on reference/global-flags.
Examples
Section titled “Examples”Rename a single stop
Section titled “Rename a single stop”gapline update stops -f gtfs.zip \ --where "stop_id=S01" \ --set stop_name="Gare Centrale" \ --confirmNo cascade is needed: stop_name is not a primary key.
Rewrite a primary key across the feed
Section titled “Rewrite a primary key across the feed”gapline update stops -f gtfs.zip \ --where "stop_id=S01" \ --set stop_id=STOP_MAIN \ --cascade --confirmEvery row in stop_times.txt, transfers.txt, pathways.txt, and any other file that references stop_id=S01 is rewritten in the same pass.
Update several fields at once
Section titled “Update several fields at once”gapline update routes -f gtfs.zip \ --where "route_id=R1" \ --set route_short_name="1" route_long_name="Boulevard" route_type=3 \ --confirmBulk-fix a classification
Section titled “Bulk-fix a classification”gapline update routes -f gtfs.zip \ --where "route_type=700" \ --set route_type=3 \ --confirmExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Records updated successfully. |
1 | --where could not be parsed, no records matched, or a PK reassignment was refused without --cascade. |
2 | Configuration error. |
3 | I/O error (feed not found, output path unwritable). |
4 | --where matched zero records. Nothing was written. |
See concepts/exit-codes for the complete table.
See also
Section titled “See also”gapline read— verify the match set before updating.gapline delete— remove the matched records instead.- Concepts / Referential integrity — how cascade chooses dependents.
- Guides / Editing with CRUD.