This isn't the most helpful error I've ever seen but from a Google it seems to be a typing error which causes the error but I just cant figure it out. Am I missing the obvious?
# Prepare SQL query to INSERT a record into the database.
sql = "INSERT INTO spin_hdd(error_count, raw_read_error, spin_up_time, allo_sec, seek_error, spin_retry, gsense_error, power_on_hours, pending_sector, load_retry, spin_up_time, max_temp, sector_count, short_test_time, long_test_time, model, serial, firmware, ip, running) \
VALUES ('%s','%s','%s','%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')" % \
(error_count, raw_read_error, spin_up_time, allo_sec, seek_error, spin_retry, gsense, power_on, pend_sec, load_retry, spin_up_time, max_temp, sector_count, testShortTime, testLongTime, model_count, serial, firmware, ip, 1)
try:
# Execute the SQL command
cur.execute(sql)
# Commit your changes in the database
con.commit()
# get last inserted id
id = cur.lastrowid
except:
# Rollback in case there is any error
con.rollback()
e = sys.exc_info()[0]
print e
integer, you need to remove'around%sint. I am guessing this from the column names. If it is the case, you will need to remove'from all those columns.