Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer working with SQLAlchemy 0.7.5 #16

Open
alibitek opened this issue Mar 3, 2012 · 1 comment
Open

No longer working with SQLAlchemy 0.7.5 #16

alibitek opened this issue Mar 3, 2012 · 1 comment

Comments

@alibitek
Copy link

alibitek commented Mar 3, 2012

I've tried to run the test.py script with SQLAlchemy 0.7.5 and ActivePython 2.7.2.5 without any success.
I get the following errors several times:
"ArgumentError: Column-based expression object expected for argument 'order_by'; got: 'stop_sequence', type <type 'str'>"
and
"InvalidRequestError: One or more mappers failed to initialize - can't proceed with initialization of other mappers. Original exception was: Column-based expression object expected for argument 'order_by'; got: 'stop_sequence', type <type 'str'>"

Maybe the order of arguments changed somewhere in the SQL Alchemy API.

Also if I try to create a database from the zippped transit using:
import gtfs
sched = gtfs.load("google_transit.zip", "transit.db")

I get the following error:
sqlalchemy.exc.ArgumentError: Column-based expression object expected for argument 'order_by'; got: 'stop_sequence', type <type 'str'>

@andrewblim
Copy link

I recently forked this project with the intention of playing with it and learning about SQLAlchemy, and ran into the same problems. I got it to work with the following code changes using SQLAlchemy 0.7.8 and using the 10 Sep 2012 BART GTFS data:

  1. In gtfs/entity/map_entities.py under create_and_map_tables() change order_by="stop_sequence" to order_by=stop_times_table.c.stop_sequence (this will fix the problem you've mentioned). order_by can't take a string as far as I know.
  2. Add something to ignore blank lines, as it stands right now it tries to parse them and returns a dict full of Nones, and I found that GTFS data files sometimes contain them. For example in gtfs/loader.py right after the for i, record loop you could insert if any(record.to_dict().values()): and reindent the rest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants