You're looking for func which generates SQL function expressions. 
See: http://docs.sqlalchemy.org/en/latest/core/expression_api.html



For your example:

from sqlalchemy.sql.expression import func

session.query(Posting).filter(func.date(Posting.timestamp_created)==func.date(my_var)).all()


On Apr 30, 2012, at 5:20 PM, Jonathan Vanasco <[email protected]> wrote:

> 
> I this class/table
> 
> class Posting:
>    id INT
>    timestamp_created TIMESTAMP
> 
> i'm trying to figure out how to execute this sql
> 
> SELECT * FROM posting WHERE date(timestamp_created) = date(%s) ;
> 
> i can't seem to find a "date" operator in the api docs.  i swear i've
> seen one before.
> 
> -- 
> 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.
> 

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