Reputation: 1
I have a script that works taking in a csv file and output to a mysql database. Everything works well, but with a new file, I'm getting an odd error that is not getting caught by a try/error sequence, which is just below -
try:
rtn = csr.execute (strg)
db.commit()
print "Successfully processed record " + str(row_index) + " with entryno=" +
entryno
except mdb.Warning, e:
print "Warning %d %s " % (e.args[0] , e.args[1])
print "Successfully processed record " + str(row_index)
except mdb.Error , e:
print "Error %d %s " % (e.args[0] , e.args[1])
print "Failed to process record " + str(row_index)
# sys.exit() (or what you want to do if an error occurs)
on syserr, I get the following mixed between my sysout -
Successfully processed record 3220 witload-pur2.py:135: Warning: Data truncated for column 'price' at row 1
rtn = csr.execute (strg)
h entryno=579848
I thought it was an error in the record (though I couldn't find it in the record or the ones surrounding it). How do I catch this and fix it??
Upvotes: 0
Views: 469
Reputation: 70557
This warning means that the price
column is set to a data type that is not big enough for the value you are trying to hold. How is the price
column declared?
Upvotes: 2