1

I am using python and specifically MySQLdb to fill a database, although a code that was working until recently is throwing up an error after moving servers at work:

The code is:

cursor.execute("""SELECT Entry, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P FROM evaluation""")

result = cursor.fetchall()

for record in result:
    codeno=int(str(record[15]))
    status, progress, reprocessing = RepStatus_new.get_status(code=codeno, proj_tag=str(record[16]),cache_dir="cache", prod_type="g1")
    cursor.execute("""UPDATE evaluation SET M=%s WHERE A LIKE %s""",(progress, int(str(record[15]))))

and the error that comes up is:

File "mySQLtest.py", line 165, in <module>
    cursor.execute("""UPDATE evaluation SET M=%s WHERE A LIKE %s""",(progress, int(str(record[15]))))
  File "/usr/lib64/python2.5/site-packages/MySQLdb/cursors.py", line 166, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib64/python2.5/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.OperationalError: (1205, 'Lock wait timeout exceeded; try restarting transaction')

I am not sure where this is going wrong, as I said this code worked until recently. If anyone has any suggestions they would be much appreciated! (I replaced variables with letters to aid read-ability!)

The database is connecting correctly, as I can output the "result" after cursor.fetchall()

Thanks in advance

0

1 Answer 1

3

It's a quick fix, but changing innodb_lock_wait_timeout might temporarily defer the "Lock wait timeout exceeded" issue. See doc.

Any chance the MySQL version, engine(s), or config's changed when you "moved servers"?

Reading the results of SHOW ENGINE INNODB STATUS would alert you to any recent locking issues.

Last time I seen this when I "moved servers", it was because of conflicting/duplicate scripts/crons trying to hit the same tables.

At any rate, you might want to push this over to serverfault.

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.