Closed pailakka closed 2 years ago
Travis CI fails:
../home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/sqlalchemy/sql/crud.py:793: SAWarning: Column 'transfers.from_trip_id' is marked as a member of the primary key for table 'transfers', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed. Primary key columns typically may not store NULL. Note that as of SQLAlchemy 1.1, 'autoincrement=True' must be indicated explicitly for composite (e.g. multicolumn) primary keys if AUTO_INCREMENT/SERIAL/IDENTITY behavior is expected for one of the columns in the primary key. CREATE TABLE statements are impacted by this change as well on most backends.
Thanks for your feedback! I realized that trip_ids in transfers.txt make transfers rather hard to model in a DB as to/from_trip_id is optional field and there could be many combinations of trip_ids for every pair of stop ids. To handle this, I added transfer_id autoincrement field to act as primary key. I'm not however sure if this is good enough solution?
Great, thanks! Indeed I'm not a specialist too, having to define a multi-column (4 fields!) primary key with both non-null and null values seems a bit complex. I do not see any drawback on having an auto-increment ID column.
I assume you have tested your changes? I can merge it w/o testing myself. Would it be possible to include a few unit tests with transfer trip IDs?
I'll do some more test and implement a few unit tests
Handle from_trip_id and to_trip_id fields in transfers.txt