Actually I think in this case you could probably leave the "secondary" argument as the association table itself, but change the join condition via the "primaryjoin" parameter. Something like this (completely untested):
class User(Base): id = Column(Integer, primary_key=True) managed_teams = relationship( 'Team', secondary=user_team_association_table, primaryjoin=sa.and_(user_team_association_table.c.user_id == id, user_team_association_table.c.is_manager==sa.true()), ) Simon On Thu, Jun 15, 2017 at 12:26 PM, <jens.troe...@gmail.com> wrote: > Thanks Simon. While this seems to have worked, I only run into the next > error. Mind you, I’m somewhat new to Alchemy and my SQL is rather rusty at > the moment. My current approach > > managed_teams = relationship("Team", > secondary="join(user_team_association, > user_team_association.c.is_manager==true)", > backref="managers") > > seems to be an incomplete join. I’ll look into this tomorrow… > Jens > > > On Thursday, June 15, 2017 at 6:25:00 PM UTC+10, Simon King wrote: >> >> Table objects put columns under the ".c" attribute, so you probably >> need "user_team_association.c.is_manager". >> >> Simon >> > -- > 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 sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- 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 sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.