title: Python sqlite3 string formatting
body: <p>I have a function like this:</p>
  
  <pre><code>def func(self, id):
      self.cursor.execute("SELECT * FROM my_table WHERE id=?", (id,))
  </code></pre>
  
  <p>This works when I pass an integer value in id:</p>
  
  <pre><code>obj.func(id=55)
  </code></pre>
  
  <p>Now I might want to reuse this function like so:</p>
  
  <pre><code>obj.func(id="associated_id")
  </code></pre>
  
  <p>Where associated_id is actually a second column in my_table. However this doesn't work (it finds no results even though there is a row where id==associated_id).</p>
  
  <p>It works if I change the function like so:</p>
  
  <pre><code>def func(self, id):
      self.cursor.execute("SELECT * FROM my_table WHERE id=%s" % str(id))
  </code></pre>
  
  <p>Why does the first version not work? Is there any way to solve this problem using sqlite3.execute parameters instead of native python string formatting?</p>