Great, thanks, I found a ticket that was already open for this and
added to it.

http://www.sqlalchemy.org/trac/ticket/1372


On Nov 17, 7:23 am, "Michael Bayer" <mike...@zzzcomputing.com> wrote:
> scott wrote:
>
> > Is there a way to filter a query involving an association_proxy?
>
> > For example, say I have a one to many relation between Pages and Tags,
> > and an association_proxy like this to let me represent tags as a list
> > of strings.
>
> > tag_objects = orm.relation('Tag')
> > tags = association_proxy('tag_objects', 'name')
>
> > Now I want to find all the pages tagged with 'foo'. As far as I know I
> > have to break the abstraction barrier provided by the
> > association_proxy and do something like:
>
> > sess.query(Page.tag_objects.any(name='foo'))
>
> > Is there any mechanism for doing something like this instead?
>
> > sess.query(Page.tags.any('foo'))
>
> > If there's nothing similar already existing, is this functionality
> > desirable? It seems like it could be really useful for clarifying
> > complex filtering, especially involving many to many relations with
> > association objects. I wrote an example patch implementing this
> > for .any() and .has(), with tests. I'm happy to post a ticket and
> > flesh it out more if it seems reasonable.
>
> >http://web.mit.edu/storborg/Public/better-associationproxy-filtering....
>
> we absolutely would want associationproxy to provide the standard
> comparison functions for free - right now its a do-it-yourself thing.   If
> you want to work on that that would be great !
>
>
>
>
>
> > Thanks,
> > Scott

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=.


Reply via email to