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, secondary=subq, 
uselist=False,primaryjoin=and_(A.id == subq.c.a_id))

class B()
   id: id: int = Column( Integer, primary_key=True)
   size= Column( Integer)

class A_rel_B()
  a_id: :int = Column(Integer, ForeignKey("A.id"))
  b_id: :int = Column(Integer, ForeignKey("B.id"))

 x: int 
q = select(X).options(
   selectinload(A).options(joinedload(A.bs)),
with_loader_criteria(A_rel_B, func.fn(A_rel_B.b_id, x).is_(True))
)

When i add with_loader_criteria(A_rel_B, func.fn(A_rel_B.b_id, 
x).is_(True)), then x value is cached and don't change. It is ok?

Thanks

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/0fb2b5d7-4321-4349-add7-7256cba8aea2n%40googlegroups.com.

Reply via email to