title: Python mysql.connector cursor.lastrowid always returns 0
body: <p>I'm using the mysql.connector module for Python 2.7. I have broken my code down to the simplest possible script, but I am still having this problem. The problem is that when I try to get the last row id (which would be <code>LAST_INSERT_ID</code> in MySQL), I get a return of 0, regardless of how many rows have been inserted. Does anyone have the solution for this problem?</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>import mysql.connector
  default_config = {
      'user': 'root',
      'password': 'password',
      'host': '127.0.0.1',
      'database': 'test',
      'raise_on_warnings': True,
      'autocommit': True
      }
  connection = mysql.connector.connect(**default_config)
  cursor = connection.cursor()
  args = ('name', 'desc')
  cursor.callproc('sp_tools_insert', args)
  lastid = cursor.lastrowid
  print lastid # This returns 0 every time, regardless of number of inserts
  </code></pre>
  
  <p>My stored procedure looks like this:</p>
  
  <pre><code>CREATE PROCEDURE `sp_tools_insert`
      (
          IN p_name VARCHAR(45), 
          IN p_description VARCHAR(255)
      )
  BEGIN 
  INSERT INTO TOOLS
      (
          tool_name, 
          description                   
      )
  VALUES 
      ( 
          p_name, 
          p_description
      ); 
  END
  </code></pre>
  
  <p>This is how my <code>TOOLS</code> table is defined:</p>
  
  <pre><code>DROP TABLE IF EXISTS `test`.`TOOLS` ;
  
  CREATE TABLE IF NOT EXISTS `test`.`TOOLS` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `tool_name` VARCHAR(45) NOT NULL,
    `description` VARCHAR(255) NOT NULL,
    PRIMARY KEY (`id`))
  ENGINE = InnoDB;
  </code></pre>
  
  <p>I have verified that the stored procedure is working correctly and the <code>.callproc()</code> call works as expected. The only thing not working is the <code>.lastrowid</code> call. Any suggestions?</p>