Can someone help me understand why I can't seem to do a simple left outer join between these two tables:

        q = self.session.query(Car, Invoice.id_)
        q = q.outerjoin(Car, Invoice)

sqlalchemy.exc.ArgumentError: Can't find any foreign key relationships between 'cars' and 'cars'.

Thanks,
Michael
---------------------------------------------------------------
class Car(Base):
    __tablename__ = 'cars'
    id_ = Column(Integer, primary_key=True)

class Invoice(Base):
    __tablename__ = 'invoices'
    id_ = Column(Integer, primary_key=True)
    car_id = Column(Integer, ForeignKey('cars.id_'))
    car = relationship(Car, backref=backref('invoices', order_by=id_),
                       primaryjoin="Invoice.car_id==Car.id_")

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to