title: Parameterize an MySQL IN clause in Python code
body: <p>I was looking at this similar question: <a href="https://stackoverflow.com/questions/337704/parameterize-an-sql-in-clause">Parameterize an SQL IN clause</a>
  But the solution is not using Python, so I had to raise a new question:
  How do I parameterize a query containing an IN clause, the strings <code>'ruby','rails','scruffy','rubyonrails'</code> comes from a column of a dataframe</p>
  <pre><code>SELECT * FROM Tags 
  WHERE Name IN ('ruby','rails','scruffy','rubyonrails')
  ORDER BY Count DESC
  </code></pre>
  <p>The dataframe <code>df</code> might look like:</p>
  <pre><code>column1  column2...
  ruby     .
  rails    . 
  scruffy  .
  xxx
  xxxx
  </code></pre>
  <p>Here's what I've tried:
  I converted the first column to a list and name it <code>list</code>, then update the second line in the query:</p>
  <pre><code>WHERE Name IN %(list)s
  </code></pre>
  <p>But this gave me an error: <code>sqlalchemy.exc.ProgrammingError: (MySQLdb._exceptions.ProgrammingError) (1064, &quot;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 'where Name IN (('ruby','rails','xxx','xxxx','xxx','' at line 2&quot;)</code></p>
  <p>I also tried <code>list = str(list)[1:-1]</code> to remove the square bracket, but then I got error: <code>MySQLdb._exceptions.ProgrammingError: (1064, &quot;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 'where Name IN ('\\'ruby\\', \\'rails\\', \\'xxxxx\\', \\'xxx\\',' at line 2&quot;)</code></p>
  <p>My question is what format/datatype I should use for <code>df[column1]</code> to get this working? Can someone help please? Thanks.</p>