Python scripts to import a GTFS dataset into a basic MySQL database.
Python Shell
Switch branches/tags
Nothing to show
Pull request Compare This branch is 6 commits ahead, 9 commits behind sbma44:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
sql_better
.gitignore
README.md
build_indices.py
gtfssnapshotcalculator.py
import.sh
load_gtfs.py
settings.py

README.md

GTFS MySQL Importer

Author: Tom Lee (thomas.j.lee@gmail.com), changes by Russell Porter (contact@russellporter.com) adding support for TransLink GTFS, and a cleaner import procedure

Description

This is a simple set of python scripts that will import a GTFS dataset into a lightweight MySQL database. The work is based on Washington, DC's WMATA GTFS dataset, and has not been thoroughly checked for completeness against the GTFS spec -- some optional fields or tables may not currently be supported (but should be trivial to add).

In addition to the GTFS fields, a number of columns have been created to assist in the conversion of GTFS's string-based date/time representations to more useful Unix timestamp-style second counts.

Prerequisites

MySQL

wget (Mac installer)

python

MySQLdB (Python module), run: easy_install MySQL-python

Usage

  1. Check sql_better/load.sql IMPORT DATA INFILE, and change the column order to match those of the CSV files you are importing
  2. Edit config.sh with your MySQL server info
  3. Run sh ./import.sh in your command line

Todo

  • GTFS Transfer import
  • Automatically match CSV columns