[Tutor] set the BETWEEN range in the SQL query using the python datetime function

Norman Khine norman at khine.net
Thu Jun 23 23:01:34 CEST 2011


hello, i have this code http://pastie.org/2112997

but i am not sure how to make the date range so that i get a list
based on the daily totals not the results i am now getting:

(2L, Decimal('173.958344'), Decimal('159.966349')) 2011-06-23 00:00:00
2011-06-23 23:59:59
(2L, Decimal('173.958344'), Decimal('159.966349')) 2011-06-22 00:00:00
2011-06-23 23:59:59
(6L, Decimal('786.816548'), Decimal('744.840562')) 2011-06-21 00:00:00
2011-06-23 23:59:59
(12L, Decimal('1410.674749'), Decimal('1326.722775')) 2011-06-20
00:00:00 2011-06-23 23:59:59
(14L, Decimal('1577.628295'), Decimal('1476.683527')) 2011-06-19
00:00:00 2011-06-23 23:59:59
(15L, Decimal('1634.608277'), Decimal('1526.667511')) 2011-06-18
00:00:00 2011-06-23 23:59:59
(18L, Decimal('2015.542555'), Decimal('1886.613796')) 2011-06-17
00:00:00 2011-06-23 23:59:59
(21L, Decimal('2306.470462'), Decimal('2156.553710')) 2011-06-16
00:00:00 2011-06-23 23:59:59
(25L, Decimal('2574.386376'), Decimal('2396.485633')) 2011-06-15
00:00:00 2011-06-23 23:59:59
(27L, Decimal('2878.338279'), Decimal('2686.445540')) 2011-06-14
00:00:00 2011-06-23 23:59:59

the problem is that i am unsure how best to set the BETWEEN range in
the SQL query using the python datetime function.

cheers

norman

-- 
˙ʇı ɹoɟ ƃuıʎɐd ǝɹ,noʎ ʍou puɐ ǝɔıoɥɔ ɐ ʞooʇ ı ʇɐɥʇ sı 'ʇlnɔıɟɟıp sı ʇɐɥʍ
˙uʍop ǝpısdn p,uɹnʇ pןɹoʍ ǝɥʇ ǝǝs noʎ 'ʇuǝɯɐן sǝɯıʇ ǝɥʇ puɐ 'ʇuǝʇuoɔ
ǝq s,ʇǝן ʇǝʎ
%>>> "".join( [ {'*':'@','^':'.'}.get(c,None) or
chr(97+(ord(c)-83)%26) for c in ",adym,*)&uzq^zqf" ] )


More information about the Tutor mailing list