Comments (4)
Hi @anthonymobile ,
You are doing nothing wrong. So far I have tested on SQLite and PostgreSQL, and not on MySQL, and that is why this bug was not discovered.
However, this raises a design issue. We use SQLAlchemy's Unicode
[1][2]. In SQLite the varchar
length is undefined, and in PostgreSQL unnecessary, while MySQL demands that we put a length. I couldn't find any string length constraint in the GTFS reference [3].
We can choose one of the following options.
- Announce that PyGTFS is not MySQL compatible, and tell users to pick a different database.
- Pick a length (255 is a popular choice), and apply it all the time. (Should we truncate?)
- Pick a length but only when the database requires it.
What do you think?
BTW, cool project!
https://github.com/anthonymobile/pi_transitsign
[1] http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.Unicode
[2] http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.String
[3] https://developers.google.com/transit/gtfs/reference
from pygtfs.
thanks... i think for me at least this is not needed. i was looking at mysql because of performance issues on a Raspberry Pi and i refactored my code so that is moot.
however, i was thinking about this a bit. it seems kind of crazy to -have- to load the entire GTFS database into memory. is there a way to select a subset of the full database through a different sqlalchemy query without substantially modifying the pygtfs code?
from pygtfs.
I am not sure what you mean by that. You can store your database on disk with SQLite or PostgreSQL, and then the amount of memory used depends on your database settings.
You can also store it in-memory in SQLite, but that does seem crazy for large GTFS datasets.
If you mean you want to put only a subset of the CSV files in your database, then that is way tougher to implement in pygtfs. You can filter the files yourself before putting them in the database.
from pygtfs.
To clarify my latest comment: You can use the included gtfs2db
script to translate your zip file to sqlite:
gtfs2db append gtfs.zip db.sqlite
Then you can use the sqlite database in pygtfs:
sched = pygtfs.Schedule("db.sqlite")
The nice thing here is that sqlite is quite smart about loading only the relevant stuff that you need.
If you are really capped by your memory use, you can always do your full preprocessing somewhere else and store only what you need on your Pi.
from pygtfs.
Related Issues (20)
- Load database from file? HOT 3
- Publish latest version on PyPI? HOT 3
- AssertionError: value outside limits - when loading in schedule HOT 2
- route_type range error from Prague's feed HOT 2
- ValueError: could not convert string to float in gtfs_entities.py HOT 5
- DeclarativeMeta object got multiple values for keyword argument 'feed_id' HOT 1
- TypeError when 'shape_dist_traveled' is empty HOT 1
- Getting validation error during the bootstrap for `location_type` not recognized HOT 1
- Unique constraint failed when trying to import the latest data from BART HOT 10
- Import fails when conditionally required route.agency_id is missing HOT 2
- pygtfs does not support UTF-8 encoding HOT 2
- Additional maintainers HOT 1
- Drop Python 2 support HOT 1
- Can not load the zip file HOT 4
- Publish 0.1.8 to pypi (and all future releases automatically) HOT 2
- Add github actions to replace broken travis
- In feeds where calendar.txt is missing, pygtfs creates entities that occur on "no day of the week" HOT 2
- Issue or Question or ?: large gtfs without calendar (only calendar_dates) HOT 2
- Load fails on feed dates missing HOT 4
- UNIQUE constraint failed: translations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygtfs.