Re: database filter with datetime ranges

2007-06-14 Thread Malcolm Tredinnick
On Thu, 2007-06-14 at 18:57 +0200, Nis Jorgensen wrote: > ZebZiggle wrote: > > Further investigation ... the sql looks good I think: > > > > ... > > FROM ... > > WHERE ( ... > > AND "igapp_stockticker"."moment" < 2007-06-14 05:00:00 > > AND "igapp_stockticker"."moment" >= 2007-06-13 05:00:00) > >

Re: database filter with datetime ranges

2007-06-14 Thread ZebZiggle
Actually ... scratch that last point ... my bad. I think I'm onto the solution and the above query seems fine. But there's definitely a django bug in there somewhere. I'll submit it later. --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: database filter with datetime ranges

2007-06-14 Thread ZebZiggle
Yes, and it gets worse. I changed my query to be: ticks = list(StockTicker.objects.filter(exchange = 1) \ .extra(where = ["symbol = '@Gold' AND moment >= '%s' AND moment < '%s' " % (postgresDate(start), postgresDate(end))]) \ .order_by('moment')) (which works dire

Re: database filter with datetime ranges

2007-06-14 Thread Nis Jorgensen
ZebZiggle wrote: > Further investigation ... the sql looks good I think: > > ... > FROM ... > WHERE ( ... > AND "igapp_stockticker"."moment" < 2007-06-14 05:00:00 > AND "igapp_stockticker"."moment" >= 2007-06-13 05:00:00) > > Is there some special markup required for postgres to utilize the time >

Re: database filter with datetime ranges

2007-06-14 Thread ZebZiggle
Further investigation ... the sql looks good I think: ... FROM ... WHERE ( ... AND "igapp_stockticker"."moment" < 2007-06-14 05:00:00 AND "igapp_stockticker"."moment" >= 2007-06-13 05:00:00) Is there some special markup required for postgres to utilize the time info? Baffled. PS> Yes, the data

database filter with datetime ranges

2007-06-14 Thread ZebZiggle
Howdy! Starting with something like this: start = 9pm on Monday end = 3am on Tuesday table.objects.filter(moment__range=(start, end)) Only brings back data until midnight on Monday. Shouldn't range use the time component of a datetime? Am I missing something? Thx in advance, Sandy --~--~-