Re: [sqlalchemy] Using primary_join with back_populates

2019-02-28 Thread Mike Bayer
On Wed, Feb 27, 2019 at 11:38 PM Pavel Pristupa wrote: > > Yes, just a typo. > The actual problem is the following: > > When I try to add back_populates('user') to User.billing_addresses and > User.shipping_addresses relationships, I get the error: > User.billing_addresses and back-reference

Re: [sqlalchemy] Using primary_join with back_populates

2019-02-27 Thread Pavel Pristupa
Yes, just a typo. The actual problem is the following: When I try to add back_populates('user') to User.billing_addresses and User.shipping_addresses relationships, I get the error: User.billing_addresses and back-reference Address.user are both of the same direction . Did you mean to set

Re: [sqlalchemy] Using primary_join with back_populates

2019-02-26 Thread Mike Bayer
you are missing and_(): billing_addresses = relationship('Address', primary_join='and_(User.id==Address.id, Address.is_billing.is_(True))', uselist=True) On Tue, Feb 26, 2019 at 5:44 AM Pavel Pristupa wrote: > > Hi everybody! > > Is there a way to use primary_join with back_populates in the

[sqlalchemy] Using primary_join with back_populates

2019-02-26 Thread Pavel Pristupa
Hi everybody! Is there a way to use primary_join with back_populates in the following case? I have two entities (sorry, I may be wrong with the exact syntax): class User(Base): id = sa.Column(sa.Integer, primary_key=True) billing_addresses = relationship('Address',