afimb / gtfslib-python

An open source library in python for reading GTFS files and computing various stats and indicators about Public Transport networks
GNU General Public License v3.0
44 stars 6 forks source link

Remove sqlalchemy multiple join path warnings #10

Closed laurentg closed 8 years ago

laurentg commented 8 years ago
SAWarning: relationship 'Route.agency' will copy column agency.feed_id to column routes.feed_id, which conflicts with relationship(s): 'Route.feed' (copies feed_info.feed_id to routes.feed_id), 'FeedInfo.routes' (copies feed_info.feed_id to routes.feed_id). Consider applying viewonly=True to read-only relationships, or provide a primaryjoin condition marking writable columns with the foreign() annotation.

Indeed there is multiple join path between some entities (feed-route conflict with feed-agency+agency-route), as we use composite keys for relationships.

In order to remove those warning we need to manually specify primary join expression in the ORM layer.