relationship accepts a "primaryjoin" attribute for this purpose:
http://docs.sqlalchemy.org/en/rel_0_7/orm/relationships.html#specifying-alternate-join-conditions
On Jun 25, 2012, at 7:23 PM, Amos wrote:
> I have a one-to-many relationship from parent to items. In my Parent class I
> define the items relationship like so:
>
> items = relationship('Item')
>
> I am using a soft-delete mechanism on items and I'd like to be able to filter
> this relationship so it only returns active items. It there a mechanism
> built-in to SQLAlchemy for filtering relationships? Something like this:
>
> items = relationship('Item', filter_by='Item.deleted_at == None')
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sqlalchemy/-/raEUiUviQNEJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.