Web lists-archives.com

Reformat: Connector/Python and calling stored procedures with backticks




Hi again,
Sorry about the bad formatting of my previous e-mail.Hopefully this copy will be more readable, or else I will just leave it at that.
I have also included some extra info at the bottom that might be relevant.
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):
<pre>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</pre>
And here is the stored procedure call that produces it:
<pre>args = (None, 'foo', 'bar', None)cursor.callproc('`insert_page`', args)</pre>
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'm using MySQL Connector/Python version 2.1.3, MySQL Server version 5.7.12, Python 3.5.1 (64-bit) on Windows 7 64-bit.
I have asked the same question on stackoverflow. I will mirror any replies to/from there that fix the issue, unless someone objects to that?
Thank you for your time.
Thank you,Magnus