On Mon, 2010-08-16 at 13:01 -0700, Italo Maia wrote:
> How's the best way to filter a date field by year?
Maybe something like:
from sqlalchemy import and_
import datetime
relevant_year = 1978
query = session.query(MyClass).filter(and_(
MyClass.my_date >= datetime.date(relevant_year, 1, 1),
MyClass.my_date < datetime.date(relevant_year + 1, 1, 1),
))
I wouldn't expect the database back-end to matter on this one but I
could be wrong.
Lance
--
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.