From: Philippe N. <sw...@fr...> - 2004-06-02 13:18:34
|
On Wed, Jun 02, 2004 at 02:13:58PM +0200, Neil Blakey-Milner wrote: > > > > > > it isn't really efficient because it fetches all articles. Is there a clean > > way to select SQLObjects given a specific date interval on DateTimeCol ? > > I just compare them to a datetime, and that works just fine for me. > Although, there's a bug where the datetime conversion uses '%s' instead > of '%S' for seconds, which probably wouldn't affect your usage. > > 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)) Cheers, Philippe |