title: MySql cursors.execute() with only one parameter: Why is a string sliced into a list?
body: <h2>Status Quo:</h2>
  
  <p>I have a working database with tables and can query, insert, update, etc. Also the cursor is connected to the right database.</p>
  
  <p>The table:</p>
  
  <p><img src="https://i.stack.imgur.com/2mwf1.png" alt="screenshot of query result"></p>
  
  <h2>Problem:</h2>
  
  <p>When it comes to querying data from a table I run into trouble:</p>
  
  <pre><code>query     = 'SELECT Last_Request_Time FROM Products WHERE idProduct = %s'
  idProduct = '106'
  cursor.execute(query, (idProduct))
  </code></pre>
  
  <p>While debugging I have a look at the cursor.execute() function: <code>params = str: 106</code> will be passed to:</p>
  
  <pre><code>stmt = operation % self._process_params(params)
  </code></pre>
  
  <p>where </p>
  
  <pre><code>res = params
  # pylint: disable=W0141
  res = map(self._connection.converter.to_mysql, res)
  </code></pre>
  
  <p>is called with <code>res = str: 106</code>. I am not sure what the converter is doing but as result <strong><code>res = list: ['1', '0', '6']</code></strong>. And these arguments will be passed to the execute function which will run into following error:</p>
  
  <pre><code>File "C:\Python27\lib\site-packages\mysql\connector\cursor.py", line 480, in execute
  "Wrong number of arguments during string formatting")
  mysql.connector.errors.ProgrammingError: Wrong number of arguments during string formatting
  </code></pre>
  
  <h2>Bad workaround:</h2>
  
  <p>I have a dirty workaround, but I am not happy with it. It may not work in some cases:</p>
  
  <pre><code>query     = 'SELECT Last_Request_Time FROM Products WHERE idProduct = %s AND Edition != %s'
  idProduct = '106'
  cursor.execute(query, (idProduct, 'A'))
  </code></pre>