Re: [sqlalchemy] Query time generated columns like hybrid properties(?)

2020-05-09 Thread taha
ostLike.user_id == user_id, PostLike.like_type, None). label('user_like')) And also this as nested for PostCommentLike and PostCOmmentReplyLike. I hope It's more clear what I need. 8 Mayıs 2020 Cuma 17:27:58 UTC+3 tarihinde Mike Bayer yazdı: > > > On Fri, May 8, 2020, at

[sqlalchemy] Query time generated columns like hybrid properties(?)

2020-05-08 Thread taha
Hi, This is simplified version of my post-comment-like models. There's 2 level of nesting. class Post(Base): description = db.Column(db.Text()) comments = relationship("PostComment", backref="post") post_likes = relationship("PostLike", backref="post", lazy='joined') user_i

[sqlalchemy] Re: Filtering self referential relationship

2020-04-13 Thread taha
Thanks a lot Mike, for the little advice and for your big work! And here's the working code for the people who comes to this page later. categories = db.session.query(Categories).filter(Categories.parent_id == None, Categories.site_id == 1).\ outerjoin(child, Categories.children).filter(Categor

[sqlalchemy] Filtering self referential relationship

2020-04-13 Thread taha
Hi, I have the following model: class Categories(Base): __tablename__ = "categories" parent_id = db.Column(db.Integer, ForeignKey('categories.id')) name = db.Column(db.String(128), nullable=False) status = db.Column(db.Boolean, nullable=False, default=True) children = relationship('Categori