Hi, everyone
I'm having trouble using MySQL Connector/Python's cursor.callproc() method to
call stored procedures whose names include backticks.
Here is the entire traceback (with minor redactions):
Traceback (most recent call last): File
"C:\Users\[...]\Bottle\Website\website.py", line 108, in <module>
cursor.callproc('`insert_page`', args) File
"C:\Users\[...]\Bottle\lib\site-packages\mysql\connector\cursor.py", line 705,
in callproc self.execute("SET {0}=%s".format(argname), (arg,)) File
"C:\Users\[...]\Bottle\lib\site-packages\mysql\connector\cursor.py", line 515,
in execute self._handle_result(self._connection.cmd_query(stmt)) File
"C:\Users\[...]\Bottle\lib\site-packages\mysql\connector\connection.py", line
488, in cmd_query result =
self._handle_result(self._send_cmd(ServerCmd.QUERY, query)) File
"C:\Users\[...]\Bottle\lib\site-packages\mysql\connector\connection.py", line
395, in _handle_result raise
errors.get_exception(packet)mysql.connector.errors.ProgrammingError: 1064
(42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'`insert_page`_arg1=NULL' at line 1
And here is the stored procedure call that produces it:
args = (None, 'foo', 'bar', None)cursor.callproc('`insert_page`', args)
Having gone through the Connector/Python manual, I have noticed demonstrations
of extended Python string formatting with the cursor.execute() method in order
to ensure correct parsing down the line, however, that doesn't seem to be
applicable to the callproc() method.
Using the MySQL Command Line Client, I'm able to call the exact same stored
procedures without any issues, so the problem has to lie somewhere within the
Python application.
I hope someone will be able to help me.
Thank you,
Magnus