SQLAlchemy - Using 'aliased' In Query With Custom Primaryjoin Relationship
I'm using SQLAlchemy (0.9.4) in my Flask application. There are two tables with soft delete support in application. class A(SoftDeleteMixin, db.Model): id = db.Column(db.BigInt
Solution 1:
OK, I figured it out.
getattr(second.table.c, 'soft_deleted') must be also with remote() annotation.
In other words primaryjoin of relationship in B.parent should look like:
(remote(B.id) == B.parent_id) & remote(B.soft_deleted).is_(False)
Post a Comment for "SQLAlchemy - Using 'aliased' In Query With Custom Primaryjoin Relationship"