[sqlalchemy] Re: Error while using CAST

2011-09-14 Thread pravin battula
Sorry for the spelling mistake.It shows an error as below. OperationalError: (OperationalError) (1292, Truncated incorrect INTEGER value: 'testing') 'UPDATE test.mytable SET `newColumn`=CAST(test.mytable.`empno` AS SIGNED INTEGER)' () On Sep 14, 6:48 pm, pravin battula pravin.batt...@gmail.com

Re: [sqlalchemy] Re: Error while using CAST

2011-09-14 Thread Mike Conley
Don't know what database you are using, but this looks like you are trying to cast the string 'testing' to an integer and the database engine says you can't do that. -- Mike Conley On Wed, Sep 14, 2011 at 9:51 AM, pravin battula pravin.batt...@gmail.comwrote: Sorry for the spelling

[sqlalchemy] Re: Error while using CAST

2011-09-14 Thread pravin battula
Hi Mike, I'm using Mysql 5.0 backend On Sep 14, 8:20 pm, Mike Conley mconl...@gmail.com wrote: Don't know what database you are using, but this looks like you are trying to cast the string 'testing' to an integer and the database engine says you can't do that. -- Mike Conley On Wed, Sep

[sqlalchemy] Re: Error while using CAST

2011-09-14 Thread pravin battula
Mike, when i execute the below sql statement directly in the database using sqlyog,it works fine but when tried with sqlalchemy it didn't. update mytable set EmpMaster = cast(empno as UNSIGNED INTEGER) On Sep 14, 8:23 pm, pravin battula pravin.batt...@gmail.com wrote: Hi Mike, I'm using Mysql

RE: [sqlalchemy] Re: Error while using CAST

2011-09-14 Thread King Simon-NFHD78
Does this work instead: table.update().values(empno = cast(table.c.empno,Integer)).execute() ie. a bare 'empno' inside your cast expression is just referring to a python variable 'empno', which you've probably set to the value 'testing' at some other point in your code. You need the column

[sqlalchemy] Re: Error while using CAST

2011-09-14 Thread pravin battula
Hi King, Thanks for the reply,I tried giving table.update().values(empno = cast(table.c.empno,Integer)).execute() but still the same the same error. OperationalError: (OperationalError) (1292, Truncated incorrect INTEGER value: 'testing') 'UPDATE test.mytable SET `empno`=CAST(test.mytable.`empno`