Michael Bayer wrote:

if we make Function do it, that would depend largely on if there is in
fact an entire class of SQL calls that use this syntax, i.e.:

  <keyword>(<column> AS <something>)

Yeah, that's why I used 'flexibility' in quotes - its not flexible if it only
ever covers one case.


otherwise we might want to throw a separate python function in the SQL
module to do it.

Which looks the better option in the long term.


as it turns out, it is as easy as this (slight repurposing of label()
though....)

    s.func.CAST(t.c.mycolumn.label('NUMERIC'))

That's cheating!

It even handles the case of casting to an explicit precision, i.e. NUMERIC(10,2)

It works for me, but it does make calculated values more tedious - having to add
the cast to each participating column.

Robert

PS Thanks for the quick fix on the bracket bug yesterday!



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to