use a text() construct as the argument to your from_statement() call, and 
specify a "typemap" of {'birthday':NormalDate} along with it.

http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?highlight=text#sqlalchemy.sql.expression.text



On Apr 19, 2010, at 5:38 AM, Rita Liang wrote:

> I have a custom type NormalDate which uses to convert Integer Date
> type to String Date type.
> 
>  but when I use form_statement to query the date.it did't work!
> 
>  however,it will work, if I use a query method...
> 
>  for example.
> 
> crew = query.from_statement("SELECT * from crew_member where "  +
> 
> "rtrim(crew_member.lastname) || rtrim(crew_member.firstname) " +
>                                                " like '%" + crew_name
> + "%'").first()
> 
> this will not work. crew.birthday shows "41274135"
> 
> 
> but " user = query.filter(CrewMember.last_name.like(u'%j
> %'.encode('gbk'))).first()" works well.
> 
> and the crew.birthday shows "1969/06/23" this is want I want....
> 
> anybody any suggestion?
> 
> -- 
> 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