{"id":13545964,"url":"https://github.com/OpenTransitTools/gtfsdb","last_synced_at":"2025-04-02T17:32:24.910Z","repository":{"id":28954089,"uuid":"32480164","full_name":"OpenTransitTools/gtfsdb","owner":"OpenTransitTools","description":"GTFS ORM using SQLAlchemy","archived":false,"fork":false,"pushed_at":"2025-03-31T22:09:34.000Z","size":7647,"stargazers_count":166,"open_issues_count":16,"forks_count":45,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-31T23:22:45.827Z","etag":null,"topics":["gtfs","gtfs-rt","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenTransitTools.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-18T19:39:09.000Z","updated_at":"2025-03-21T21:17:06.000Z","dependencies_parsed_at":"2023-01-14T13:49:43.960Z","dependency_job_id":"d9d5cf02-c2b3-48a6-aeda-e23fed0a2188","html_url":"https://github.com/OpenTransitTools/gtfsdb","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTransitTools%2Fgtfsdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTransitTools%2Fgtfsdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTransitTools%2Fgtfsdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenTransitTools%2Fgtfsdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenTransitTools","download_url":"https://codeload.github.com/OpenTransitTools/gtfsdb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246860228,"owners_count":20845630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gtfs","gtfs-rt","python"],"created_at":"2024-08-01T12:00:28.955Z","updated_at":"2025-04-02T17:32:24.899Z","avatar_url":"https://github.com/OpenTransitTools.png","language":"Python","readme":"===========\nGTFSDB\n===========\n\n\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n   :alt: Join the chat at https://gitter.im/OpenTransitTools/gtfsdb\n   :target: https://gitter.im/OpenTransitTools/gtfsdb?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\n\n\nSupported Databases\n*******************\n\n* PostgreSQL (PostGIS for Geo tables) - preferred\n* Oracle - tested\n* MySQL  - tested\n* SQLite - tested\n\n\nGTFS (General Transit Feed Specification) Database\n**************************************************\n\nPython code that will load GTFS data into a relational database, and SQLAlchemy ORM bindings to the GTFS tables in the gtfsdb. The gtfsdb project's focus is on making GTFS data available in a programmatic context for software developers. The need for the gtfsdb project comes from the fact that a lot of developers start out a GTFS-related effort by first building some amount of code to read GTFS data (whether that's an in-memory loader, a database loader, etc...);  GTFSDB can hopefully reduce the need for such drudgery, and give developers a starting point beyond the first step of dealing with GTFS in .csv file format.\n\nAvailable on pypi: https://pypi.python.org/pypi/gtfsdb\n\n\nInstall from source via github (if you want the latest code) :\n**************************************************************\n\n#. Install Python 3.x https://www.python.org/downloads/ (code also runs on 2.7 if you are stuck on that version)\n#.  `pip install zc.buildout` - https://pypi.org/project/zc.buildout\n#. (optional step for **postgres users**: 'pip install psycopg2-binary')\n#. git clone https://github.com/OpenTransitTools/gtfsdb.git\n#. cd gtfsdb\n#. buildout install prod -- NOTE: if you're using postgres, do a 'buildout install prod postgresql'\n#. bin/gtfsdb-load --database_url \u003cdb url\u003e  \u003cgtfs file | url\u003e\n#. examples:\n\n   * bin/gtfsdb-load --database_url sqlite:///gtfs.db gtfsdb/tests/large-sample-feed.zip\n\n   * bin/gtfsdb-load --database_url sqlite:///gtfs.db http://developer.trimet.org/schedule/gtfs.zip\n\n   * bin/gtfsdb-load --database_url postgresql://postgres@localhost:5432 --is_geospatial http://developer.trimet.org/schedule/gtfs.zip\n\n     .. note:: adding the `is_geospatial` cmdline flag, when paired with a spatial-database ala PostGIS (e.g., is_spatial is meaningless with sqlite), will take longer to load...but will create geometry columns for both rendering and calculating nearest distances, etc...\n\n#. view db ( example: https://sqliteonline.com )\n\nThe best way to get gtfsdb up and running is via the 'zc.buildout' tool.  Highly recommended to first install\nbuildout (e.g., pip install zc.buildout) before doing much of anything else.\n\nPostgres users, gtfsdb requires the psycopg2-binary database driver.  Installing that via `pip install psycopg2-binary` will relieve gtfsdb from re-installing locally as part of the build.  And if after the fact, you see *exceptions* mentioning\n\n.. note:: if you get the message \"ImportError: No module named psycopg2\", then 'pip install psycopg2-binary' should fix things. (Assumes you have postgres also installed on the machine you're trying to use the pg driver).\n\n\nUsage with Docker:\n******************\n\n#. Build the image with `docker build -t gtfsdb .`\n#. Run it with:\n\n  .. code-block:: bash\n\n     docker run gtfsdb --database_url \u003cdb url\u003e  \u003cgtfs file | url\u003e\n\n  .. note:: The entrypoint command is `bin/gtfsdb-load` so the arguments will be passed to it.\n\n\nExample Queries:\n****************\n\n* get first stop time of each trip for route_id 1\n\n  .. code-block:: sql\n\n     select *\n     from trips t, stop_times st\n     where t.route_id = '1'\n     and t.trip_id = st.trip_id\n     and st.stop_sequence = 1\n\n* get agency name and number of routes\n\n  .. code-block:: sql\n\n     select a.agency_name, a.agency_id, count(r.route_id)\n     from routes r, agency a\n     where r.agency_id = a.agency_id\n     group by a.agency_id, a.agency_name\n     order by 3 desc\n","funding_links":[],"categories":["Frameworks and Libraries","Producing Data","Python","Uncategorized"],"sub_categories":["GTFS","Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenTransitTools%2Fgtfsdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOpenTransitTools%2Fgtfsdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenTransitTools%2Fgtfsdb/lists"}