From: Neil Blakey-M. <nb...@mi...> - 2004-06-02 13:24:59
|
On Wed 2004-06-02 (15:15), Philippe Normand wrote: > > a = sql.table.acct > > if start_date: > > criteria.append(a.stamp_inserted >= start_date) > > if end_date: > > criteria.append(a.stamp_inserted < end_date) > > > > But it doesn't change the problem, too many objects are fetched from the db. > Or am I missing something ? > > I'd like to compare dates directly in select() and not in select() results. > Following your code snippet, I'll try something like: > > table.select((Table.q.stamp_inserted >= start_date) & > (Table.q.stamp_inserted < end_date)) Sorry, I tend to build up a criteria list, and go: table.select(AND(*criteria)) So yes, it will work for select queries just fine. Just mind the bug if seconds are at all important to you. Neil -- Neil Blakey-Milner nb...@mi... http://mithrandr.moria.org/ |