Any query using sql expressions is going to want to use correctly typed data
-- you're trying to query a date column with a string value. The LIKE
operator is for string data.

I'm not up on my mssql date expressions, but the answer is going to resemble
something like this:

.........filter(and_(func.datepart('year', List.expire) == 2007,
func.datepart('month', List.expire) == the_month_number))

On 12/9/07, Adam B <[EMAIL PROTECTED]> wrote:
>
>
> Hello!
>
> I'm trying to do a query that gets all lists within a specific month,
> but
> SQLAlchemy whines. :/
>
>
> The error:
> /usr/local/lib/python2.4/site-packages/SQLAlchemy-0.4.1-py2.4.egg/
> sqlalchemy/databases/mysql.py:1475: Warning: Incorrect datetime value:
> '"2007-"+str(month)+"%"' for column 'expire' at row 1
>   cursor.execute(statement, parameters)
>
> The code:
> L =
> session.query(List).join('friends').filter(
> Friend.username==identity.current.user_name).filter(List.expire.like
> ('"2007-"+str(month)
> +"%"')).all()
>
>
> columnt "expire" is DateTime in the model.
>
> Any ideas how to do this?
>
> br
>
> Adam
>
> >
>

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