On Nov 6, 2008, at 8:29 PM, Adam Ryan wrote:

>
>
> Wow, this is great stuff.  I'll have to spend some time trying it out.
>
> My big question, though, is how to interact with this stored query
> using and_ and or_?
>
> I went off on a different track where I would store a list of filter
> objects with their respective method (and_, or_), and put them back
> together in a nested filter beast like so:
>
> # filter_list is a list of tuples: ( filter_object, filter_method)
>
> nested = None
> for filter, method  in filter_list:
>    if not nested:
>        nested = filter
>    else:
>        nested = method( filter, nested )
>
> query = query.filter( nested )
> res = query.all()
>
> If instead I stored the query object, how would I then and_ and or_
> it?

you'd have to pull the _criterion off the Query and combine that into  
a new Query using and_ or or_.  So you might want to just pickle the  
WHERE criterion instead of the whole Query object if that's all you  
need.   Basically everything is picklable with this new module.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to