Mobsql: CLI Documentation

The following CLI documentation is automatically generated from using the -h flag on each mobsql subcommand. These docs provide a good comprehensive high-level overview of functionality for each CLI subcommand. If you are looking for a more step-like tutorial / guide to using mobsql's CLI; please see also the userguide.

Mobsql CLI: usage

Usage of ./mobsql:
  mobsql [subcommand]

Description:
    Mobsql is a GTFS to SQLite import utility. See http://git.sr.ht/~mil/mobsql

Subcommands:
  - loadmdbgtfs: Load one or more Mobility Database GTFS feeds to the local SQLite DB
  - loadcustomgtfs: Load a custom GTFS feed archive (via URL or local file) to the local SQLite DB
  - purge: Purge GTFS feed data & computed data from the local SQLite DB
  - status: Query the loaded data status of feeds from the local SQLite DB
  - feedsearch: Search for usable feed IDs in the Mobility Database 

Mobsql CLI: loadmdbgtfs

Usage of ./mobsql loadmdbgtfs:

Description:
  The loadmdbgtfs subcommand loads GTFS data for the given Mobility Database feed ID into the local SQLite database.    

Flags: 
  -h    Show this usage message
  -p string

        JSON Parameters for loadmdbgtfs subcommand, should be in format of: {"feed_ids": [516, ...]}

        Required load parameters:
          - feed_ids: Array of integer feed IDs (MDBID) to use for load command (ex: [516, 510])

        Optional load parameters:
          - update: Force update Mobility Database & ignore all caching systems (useful for feed updates)
          - direct_urls: Use direct 'agency' URLs from the Mobility Database. By default, if false,
                         Mobility Database "bucket" / :"latest" cached URLs are used (which are
                         more *stable* / reliable) however may not reflect latest changes from 
                         agency itself (as bucket URLs are updated roughly 2x a week).
          - mobsql_config: Object to override default mobsql config object


Examples:
  Brussels LoadMDBGTFS Example:
    mobsql loadmdbgtfs -p '{"feed_ids":[1088]}'
  Brussels LoadMDBGTFS (Update) Example:
    mobsql loadmdbgtfs -p '{"feed_ids":[1088], "update": true}'
  Brussels LoadMDBGTFS (Use Direct URL) Example:
    mobsql loadmdbgtfs -p '{"feed_ids":[1088], "direct_urls": true}'

Mobsql CLI: loadcustomgtfs

Usage of ./mobsql loadcustomgtfs:

Description:
  The loadcustomgtfs subcommand loads a custom GTFS source to the SQLite database. You specify the GTFS source archive by specifying the gtfs_uri field. Note all custom sources must have a feed_id < -1.  

Flags: 
  -h    Show this usage message
  -p string

        JSON Parameters for loadcustomgtfs subcommand, should be in format of: {"feed_id": -33, "gtfs_uri": "URL"}

        Required loadcustomgtfs parameters:
          - feed_id: Arbitrary custom feed ID for your GTFS source, must be <-1 (ex: -33)
          - gtfs_uri: URI for either a local file or a remote HTTP GTFS Zip (ex: http://web.mta.info/developers/data/nyct/subway/google_transit.zip)

        Optional loadcustomgtfs parameters:
          - mobsql_config: Object to override default mobsql config object


Examples:
  File LoadCustomGTFS Example:
    mobsql loadcustomgtfs -p '{"feed_id":-33, "gtfs_uri": "file:///path/to/some/gtfs.zip"}'
  URL LoadCustomGTFS Example:
    mobsql loadcustomgtfs -p '{"feed_id":-33, "gtfs_uri": "http://web.mta.info/developers/data/nyct/subway/google_transit.zip"}'

Mobsql CLI: purge

Usage of ./mobsql purge:

Description:
  The purge subcommand removes either GTFS data or computed data from the local SQLite database for the given feed IDs.     

Flags: 
  -h    Show this usage message
  -p string

        JSON Parameters for purge subcommand, should be in format of: {"feed_ids": [516, ...], "purge_tables": "all"}

        Required purge parameters:
          - feed_ids: Array of integer feed IDs (MDBID) to use for purge command (ex: [516, 510])
          - purge_tables: Either 'all', 'computed', or 'gtfs'

        Optional purge parameters:
          - mobsql_config: Object to override default mobsql config object


Examples:
  Brussels Purge GTFS Data Example:
    mobsql purge -p '{"feed_ids":[1088], "purge_tables": "gtfs"}'
  Brussels Purge Computed Data Example:
    mobsql purge -p '{"feed_ids":[1088], "purge_tables": "computed"}'
  Brussels Purge All Data Example:
    mobsql purge -p '{"feed_ids":[1088], "purge_tables": "all"}'

Mobsql CLI: status

Usage of ./mobsql status:

Description:
  The status subcommand queries the status and metadata for a given set of feed IDs in the local SQLite database. After performing a load, purge, or compute operation this command can be used to confirm.

Flags: 
  -h    Show this usage message
  -p string

        JSON Parameters for purge subcommand, should be in format of: {"feed_ids": [516, ...]}

        Required purge parameters:
          - feed_ids: Array of integer feed IDs (MDBID) to use for status command (ex: [516, 510])

        Optional status parameters:
          - mobsql_config: Object to override default mobsql config object


Examples:
  Brussels Status Example:
    mobsql status -p '{"feed_ids":[1088]}'

Mobsql CLI: feedsearch

Usage of ./mobsql feedsearch:

Description:
  The feedsearch subcommand allows you to search the Mobility Database for feed IDs that can be loaded and interfaced with by Mobsql. Its return format is the same as the status CLI command however it allows you to pass the 'searchfilter' field to filter all Mobility Database feeds based on a number of field (see examples).   

Flags: 
  -h    Show this usage message
  -p string

        JSON Parameters for feedsearch subcommand, should be in format of: {"searchfilter": {"country": "BE",...}}

        Required feedsearch parameters:
          - searchfilter: Object which may contain the following keys:
            {feed_id, country, municipality, subdivision, provider, name, glob, bbox, maxkm, loaded}
            see Go Documentation or examples for more info.

        Optional feedsearch parameters:
          - mobsql_config: Object to override default mobsql config object


Examples:
  Specific feed_id example:
    mobsql feedsearch -p '{"searchfilter":{"feed_id": [510, 516]}}'
  Municipality example:
    mobsql feedsearch -p '{"searchfilter":{"municipality": "paris"}}'
  Subdivision example:
    mobsql feedsearch -p '{"searchfilter":{"municipality": "ontario"}}'
  Bbox contains coords example:
    mobsql feedsearch -p '{"searchfilter":{"coords": [[40.512764, -74.251961]]}}'
  Loaded to SQLite DB example:
    mobsql feedsearch -p '{"searchfilter":{"loaded": true}}'
  Country example:
    mobsql feedsearch -p '{"searchfilter":{"country": "BE"}}'
  Glob (search all fields) example:
    mobsql feedsearch -p '{"searchfilter":{"glob": "foo"}}'
  Max km example:
    mobsql feedsearch -p '{"searchfilter":{"maxkm": 20}}'
  Combination example:
    mobsql feedsearch -p '{"searchfilter":{"glob": "foo", "country": "US"}}'