I am trying to perform the following insert operation:
cursor.execute(""" insert into tree (id,parent_id,level,description,code,start,end) values (%d,%d,%d,%s,%s,%f,%f) """, (1,1,1,'abc','def',1,1) )
The structure of my MYSQL table:
id int(255), parent_id int(255), level int(11), description varchar(255), code varchar(255), start decimal(25,4), end decimal(25,4)
However, when I run my program, I get an error
"File" / usr / lib / pymodules / python 2.6 / MySQLdb / cursors.py ", line 151, executed by query = query% db.literal (args)
TypeError: format% d: number is required, not str "
python mysql-python insertion
user721975 Apr 26 '11 at 2:01 2011-04-26 02:01
source share