Re: [sqlalchemy] Can't get join() to work

2019-03-29 Thread 'Neil Youngman' via sqlalchemy
On Friday, 29 March 2019 15:30:39 UTC, Neil Youngman wrote: > > > That needs to be: > supplying_dealer = relationship(Dealer, > primaryjoin=supplying_dealer_id == Dealer.dealer_id) > servicing_dealer = relationship(Dealer, > primaryjoin=servicing_dealer_id == Dealer.dealer_id) > and

Re: [sqlalchemy] Can't get join() to work

2019-03-29 Thread 'Neil Youngman' via sqlalchemy
On Friday, 29 March 2019 15:10:27 UTC, Neil Youngman wrote: > > > supplying_dealer = relationship(Dealer, supplying_dealer_id == > Dealer.dealer_id) > servicing_dealer = relationship(Dealer, servicing_dealer_id == > Dealer.dealer_id) > > That needs to be: supplying_dealer =

Re: [sqlalchemy] Can't get join() to work

2019-03-29 Thread 'Neil Youngman' via sqlalchemy
On Friday, 29 March 2019 13:48:33 UTC, Simon King wrote: > > > You haven't created a relationship() between Vehicle and Dealer, which > reduces your options a little bit. This should work: > > session.query(Vehicle).join(Dealer, Vehicle.supplying_dealer == > Dealer.id) > > ie. you need

Re: [sqlalchemy] Can't get join() to work

2019-03-29 Thread Simon King
On Fri, Mar 29, 2019 at 12:17 PM 'Neil Youngman' via sqlalchemy wrote: > > I'm trying to do a select of columns from a join and I simply can't get it to > work. I have tried various different ways to specify the join, with and > without a select_from() and I can't find a combination that works.

[sqlalchemy] Can't get join() to work

2019-03-29 Thread 'Neil Youngman' via sqlalchemy
I'm trying to do a select of columns from a join and I simply can't get it to work. I have tried various different ways to specify the join, with and without a select_from() and I can't find a combination that works. the tables look like class Dealer(Base): __tablename__ = 'dealers'