0

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??

1 Answer 1

2

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.