title: MySQL Stored Procedures, Pandas, and "Use multi=True when executing multiple statements"
body: <p><strong><em>Note - as MaxU suggested below, the problem is specific to  mysql.connector and does not occur if you use pymysql.  Hope this saves someone else some headaches</em></strong></p>
  
  <p>Using Python, Pandas, and mySQL and cannot get a stored procedure to return results at all, let alone into a data frame.</p>
  
  <p>I keep receiving errors about multiple queries, but the stored procedures I am running are extremely simple parameter driven queries.  </p>
  
  <p>It doesn't matter what stored procedure I use, it is always the same result</p>
  
  <p>In fact, the test procedure below (sp_test) is the following query - </p>
  
  <pre><code>select * from users;
  </code></pre>
  
  <p>If I run the same statement with</p>
  
  <pre><code>df=pd.read_sql("select * from users", cnx,index_col=None, coerce_float=True)
  </code></pre>
  
  <p>Instead of </p>
  
  <pre><code>df=pd.read_sql("call sp_test()", cnx,index_col=None, coerce_float=True)
  </code></pre>
  
  <p>It works fine, even though <strong>sp_test</strong> is <strong>select * from users</strong>   </p>
  
  <p>Why do I keep getting multi=true error messages and how do I go about fixing the problem and getting the results of my stored procedure?  I don't understand how a simple select statement would return multiple result sets.</p>
  
  <p>If there is another way to do this, happy to try it.</p>
  
  <p>Following is the simple code I am using</p>
  
  <pre><code>import pandas as pd
  from pandas.io.data import DataReader
  from pandas import DataFrame
  import mysql.connector
  
  cnx = mysql.connector.connect(user='jeff', password='password', database='testdatabase', host='xx.xxx.xxx.xx')
  df=pd.read_sql("call sp_test()", cnx,index_col=None, coerce_float=True)
  </code></pre>
  
  <p>When I get to pd.read_sql, I get the following error message</p>
  
  <pre><code>InterfaceError                            Traceback (most recent call last)
  C:\Users\User\AppData\Local\Continuum\Anaconda3\lib\site-    packages\mysql\connector\cursor.py in execute(self, operation, params, multi)
      506             try:
  --&gt; 507                 self._handle_result(self._connection.cmd_query(stmt))
      508             except errors.InterfaceError:
  
  C:\Users\User\AppData\Local\Continuum\Anaconda3\lib\site-packages\mysql\connector\connection.py in cmd_query(self, query)
  725             raise errors.InterfaceError(
  --&gt; 726                 'Use cmd_query_iter for statements with multiple queries.')
  727 
  
  InterfaceError: Use cmd_query_iter for statements with multiple queries.
  
  During handling of the above exception, another exception occurred:
  
  InterfaceError                            Traceback (most recent call last)
  C:\Users\User\AppData\Local\Continuum\Anaconda3\lib\site-    packages\pandas\io\sql.py in execute(self, *args, **kwargs)
     1563             else:
  -&gt; 1564                 cur.execute(*args)
     1565             return cur
  
  C:\Users\User\AppData\Local\Continuum\Anaconda3\lib\site-    packages\mysql\connector\cursor.py in execute(self, operation, params, multi)
      510                     raise errors.InterfaceError(
  --&gt; 511                         "Use multi=True when executing multiple statements")
      512                 raise
  
  InterfaceError: Use multi=True when executing multiple statements
  </code></pre>