title: AttributeError: 'tuple' object has no attribute 'encode' - MySQLdb Python
body: <p>I am writing a Python code with MySQL. </p>
  
  <p>My DB schema is as follows:</p>
  
  <pre><code>-------------
  | id | name |
  -------------
  |    |      |
  |    |      |
  </code></pre>
  
  <p>Following is a part of my code:</p>
  
  <pre><code>cursor = self.conn.cursor()
  query = ("SELECT name FROM TABLENAME WHERE id = '%s'", (str(id.decode('unicode_escape').encode('ascii', 'utf-8'),)))
  cursor.execute(query)
  </code></pre>
  
  <p>I am passing the ID from the URL. </p>
  
  <p>And getting the following error:</p>
  
  <blockquote>
    <p>AttributeError: 'tuple' object has no attribute 'encode'</p>
  </blockquote>
  
  <p>I get the results when I hard-code the valud of ID in the query. But for some reason it is not working when I pass in a parameter.</p>