title: How to string format SQL IN clause with Python
body: <p>I am trying to create a statement as follows:</p>
  
  <pre><code>SELECT * FROM table WHERE provider IN ('provider1', 'provider2', ...)
  </code></pre>
  
  <p>However, I'm having some trouble with the string formatting of it from the Django API. Here's what I have so far:</p>
  
  <pre><code>profile = request.user.get_profile()
  providers = profile.provider.values_list('provider', flat=True) # [u'provider1', u'provider2']
  providers = tuple[str(item) for item in providers] # ('provider1', 'provider2')
  
  SQL = "SELECT * FROM table WHERE provider IN %s"
  args = (providers,)
  cursor.execute(sql,args)
  
  DatabaseError
  (1241, 'Operand should contain 1 column(s)')
  </code></pre>