Trying to run a stored proc, I get the error "Commands out of sync; You can't run this command now". The MySQL documentation on this error is useless, and doesn't seem to apply to the actual SQL in my proc, so I can only assume it's a bug in how MySQLdb wraps the db connection.
My usage is very simple. I'm simply doing a cursor.execute(...) followed by a cursor.fetchall(). No threads or multiple uses of the same cursor.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Try cursor.callproc(...) instead of cursor.execute(...). Then you'll have to use cursor.nextset() until it returns an empty result set. Read PEP-249 for the correct usage, but note that due to some MySQL design choices, callproc() can't return any out or inout parameters; see the MySQLdb docs as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Trying to run a stored proc, I get the error "Commands out of sync; You can't run this command now". The MySQL documentation on this error is useless, and doesn't seem to apply to the actual SQL in my proc, so I can only assume it's a bug in how MySQLdb wraps the db connection.
My usage is very simple. I'm simply doing a cursor.execute(...) followed by a cursor.fetchall(). No threads or multiple uses of the same cursor.
Try cursor.callproc(...) instead of cursor.execute(...). Then you'll have to use cursor.nextset() until it returns an empty result set. Read PEP-249 for the correct usage, but note that due to some MySQL design choices, callproc() can't return any out or inout parameters; see the MySQLdb docs as well.