try this:

from sqlalchemy import func
session.query(MyObj).fitler(func.strftime('%Y',MyObj.date_field)=='2004').all()

On 08/16/2010 01:03 PM, Italo Maia wrote:
By the way, sqlite here!

2010/8/16 Italo Maia <[email protected] <mailto:[email protected]>>

    How's the best way to filter a date field by year?

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




--
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Graduado em Ciência da Computação - UECE
Desenvolvedor WEB e Desktop (Java, Python, Lua)
Coordenador do Pug-CE
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
turtle linux 910 - http://tiny.cc/blogturtle910
===========================
--
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.


--
David Gardner
Pipeline Tools Programmer
Jim Henson Creature Shop
[email protected]

--
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