[sqlalchemy] Re: sqlalchemy decides to pull entire table

2008-05-22 Thread Michael Bayer
On May 21, 2008, at 7:42 PM, arashf wrote: > > I'm running this query: q = Event.query.filter(and_(Event.id < > id_under, Event.feed == True, > Event.ns_id.in_(ns_list))).limit(num).order_by([Event.updated.desc(), > Event.id.desc()]) > > For some reason, sqlalchemy decides to pull the entire tab

[sqlalchemy] Re: sqlalchemy decides to pull entire table

2008-05-22 Thread Michael Bayer
On May 21, 2008, at 8:13 PM, Rick Morrison wrote: > The "and_" function is expecting two arguments, not a series of > *args. It works when you remove the third argument because you then > have the expected two arguments. and_() and or_() still take *args. --~--~-~--~~

[sqlalchemy] Re: sqlalchemy decides to pull entire table

2008-05-21 Thread arashf
hmm, I switched from 3 args to 2 and am still having the same issue. On May 21, 5:13 pm, "Rick Morrison" <[EMAIL PROTECTED]> wrote: > The "and_" function is expecting two arguments, not a series of *args. It > works when you remove the third argument because you then have the expected > two argum

[sqlalchemy] Re: sqlalchemy decides to pull entire table

2008-05-21 Thread Rick Morrison
The "and_" function is expecting two arguments, not a series of *args. It works when you remove the third argument because you then have the expected two arguments. Either use nested calls to "and_", or multiple calls to filter(), and build up the query in a generative fashion, like this: Event.q