Would "create_date >= '2007-01-01' and create_date < '2008-01-01'" be
acceptable?
If so, something like this should work
from sqlalchemy import and_
from datetime import date
data = Table.query().filter(and_([Mikropost.c.create_date >= date(2007,
1, 1),
Mikropost.c.create_date < date(2008,
1, 1)]))
Hope that helps,
Simon
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
On Behalf Of [EMAIL PROTECTED]
Sent: 18 January 2008 13:22
To: sqlalchemy
Subject: [sqlalchemy] Filter by year in datetime column
Hello, pleas, i have begginer problem and question:
In table (database is sqlite) is colum for create date (create_date =
Field(DateTime, default = datetime.now))
I need query from table, with all item where have year of create date
2007.
Is this the right way ? (this don`t work)
data = Table.query().filter(func.year(Mikropost.c.create_date) ==
2008)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---