Table objects put columns under the ".c" attribute, so you probably
need "user_team_association.c.is_manager".

Simon

On Thu, Jun 15, 2017 at 12:11 AM,  <[email protected]> wrote:
> Thank you Mike, the composite joins look like something close to what I
> need. However, it seems that they too require a mapped class for the
> association table?
>
> I tried
>
>     managed_teams = relationship("Team",
>
> secondary="join(user_team_association.is_manager==true)",
>                                  backref="managers")
>
> using the table name directly, but this gives me an error:
>
> AttributeError: 'Table' object has no attribute 'is_manager'
>
> which I suspect indicates that the join expected a mapped class rather than
> a table name?
>
> Thanks!
>
>
>
> On Thursday, June 15, 2017 at 7:05:45 AM UTC+10, Mike Bayer wrote:
>>
>>
>> On 06/14/2017 04:54 PM, [email protected] wrote:
>> > […]
>> >
>> >     # Filtered association that lists only managed teams. The tuple maps
>> >     # the column to the value and would translate to a WHERE.
>> >          managed_teams =relationship("Team",
>> >
>> > secondary=user_team_association_table,
>> >                                       backref="managers",
>> >                                       filter=("is_manager",True))
>>
>>
>> you use a custom primaryjoin / secondaryjoin for this
>>
>> see  http://docs.sqlalchemy.org/en/latest/orm/join_conditions.html
>>
>>
>> http://docs.sqlalchemy.org/en/latest/orm/join_conditions.html#composite-secondary-joins
>>
>> etc
>>
> --
> 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 post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to