On Thursday, July 22, 2010 12:24:53 Timuçin Kızılay wrote:
> Diez B. Roggisch yazmış:
> > On Thursday, July 22, 2010 11:47:13 Timuçin Kızılay wrote:
> >> I'm trying to make a query like this:
> >> 
> >> prc_filter = 24
> >> 
> >> q_sometable = DBSession.query(model.Sometable)
> >> q_sometable = q_sometable.filter((model.Sometable.qty *
> >> model.Sometable.price)==prc_filter)
> >> 
> >> This do not give any error and when I look at the paster log I see that
> >> it generated a query with where part like this:
> >> 
> >> ------------
> >> WHERE sometable.qty * sometable.price = ?
> >> 
> >> 12:41:24,272 INFO  [sqlalchemy.engine.base.Engine.0x...ba0c] ['24']
> > 
> > This looks as if the above is *not* what you really do. Because '24' is a
> > *string*, not an integer...
> > 
> > Diez
> 
> No, it's an integer but the log shows it as string.
> I think the problem is filtering on two columns multiplied.
> 
> When I filter only one column, it works.
> 
> q_sometable = q_sometable.filter(model.Sometable.price==prc_filter)
> 
> this filter works and generated sql shown on the log is still ['24'] but
> it works.

Ah. Strange enough.

> 
> I think it's a SA bug, it try to put those values into query as parameters.
> 

If so, I suggest you take it to the SA-mailinglist. Michael Bayer is 
incredible responsive. Of course you should try with the latest + greatest SA 
first.

Diez

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.

Reply via email to