This thing is called referential integrity
(https://en.wikipedia.org/wiki/Referential_integrity) and is enforced on
the database level - you can't have a value in Child.parent_id which is not
in Parent.id. The ForeignKey creates a constraint in the database which
ensures the referential
Suppose I have a Parent and Child table with Child having
parent_id = Column(Integer, ForeignKey('parent.id'), back_populates=
'children', nullable=False)
parent = relationship('parent')
and Parent having
children = relationship('child', back_populates='parent')
Then if I try to delete a Parent,
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
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',