I need EmptyQuery because query that returns from my function used for
different cases,
and if I return [], it will raise error, because [] not has query methods
like order_by.

e.g.
query1 = getComments(user_id).order_by('comment.time_create desc')
query2 = getComments(user_id).order_by('id')
query3 = getComments(user_id).order_by('comment.user_id')

I can check if instead of query function returns empty list and not apply
order_by,
but if function return EmptyQuery will be very better.


Thanks!


On Sun, Dec 11, 2011 at 10:28 PM, Michael Bayer <mike...@zzzcomputing.com>wrote:

>
> On Dec 11, 2011, at 1:06 PM, Michael Bayer wrote:
>
> >
> > In the above case, you'd just say "comments_replies = []".
>
> correction, as you're attempting to return a Query; you'd factor the
> calling code to expect that an empty list of user_ids as input should
> result in an empty result that can't be further generated.
>
> An EmptyQuery type of object on the SQLA side would be very challenging to
> implement and test and I'm not sure would present a generalized solution to
> the "X IN ()" problem  - cases like:
>
> query(Parent).outerjoin(Child, Parent.children).filter(Child.id.in_([]))
>
> The Query clearly can still return results.  There's lots of ways it might
> be very hard to decide how an EmptyQuery should be evaluated.
>
> --
> 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
> sqlalchemy+unsubscr...@googlegroups.com.
> 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 sqlalchemy@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=en.

Reply via email to