Conversion of data during alteration of column in SQLAlchemy
I'm trying to convert the data type of a column from string to integer. The column has some string values in it.
When doing table.c.emp_no.alter(type=Integer)
, I get this error:
OperationalError: (OperationalError) (1366, "Incorrect integer value: 'terwte' for column 'newColumn' at row 1")
'\nALTER TABLE test.mytable CHANGE COLUMN `newColumn` `newColu开发者_C百科mn` INTEGER' ()
Please help me.
By default, MySQL is enabled with strict_mode ON.
Open your "my.ini" file within the MySQL installation directory, and look for the text "sql-mode" and comment-out.
#sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
精彩评论