Patrick McKinnon wrote:
> I used to be able to select from a mysql "date" column using a
> datetime object; where the timestamp would be ignored because the DB
> schema isn't using the datetime column type.
> 
> query = Table.query().filter(Table.c.date == datetime(2007, 1, 1))
> 
> The mysql log shows the select being generated like this:
> 
> ... table.date =  '2007-01-01 00:00:00.00' ...
> 
> Which doesn't return any results because of the timestamp.
> 
> If however, I string format my date in the query the proper mySQL
> query is generated:
> 
> query = Table.query().filter(Table.c.date == "%4d-%02d-%02d" % 2007,
> 1, 1))
> 
> Am I doing something wrong?
> 
> Thanks!

For dates you want datetime.date rather than datetime.datetime.

-j

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to