Re: [sqlalchemy] With loader criteria and baked query cache

2022-01-07 Thread Mike Bayer
i dont think with_loader_criteria ever expected the target entity to be part of "secondary" in a relationship(). I have no idea what that would do and I'm surprised it works at all. I would try instead to map from A->A_rel_B->B explicitly and use two relationships for this join. On Fri,

[sqlalchemy] With loader criteria and baked query cache

2022-01-07 Thread Tomas Pavlovsky
Hello Mike, class X() id: id: int = Column( Integer, primary_key=True) a_id:int = Column(Integer, ForeignKey("A.id")) subq = select(A_rel_B).join(B).order(B.size).limit(10) class A() id: id: int = Column( Integer, primary_key=True) bs = relationship(B, viewonly=True,