title: Using prepared statements with mysql in python
body: <p>I am trying to use SQL with prepared statements in Python.  Python doesn't have its own mechanism for this so I try to use SQL directly:</p>
  
  <pre><code>sql = "PREPARE stmt FROM ' INSERT INTO {} (date, time, tag, power) VALUES (?, ?, ?, ?)'".format(self.db_scan_table)
  self.cursor.execute(sql)
  </code></pre>
  
  <p>Then later, in the loop:</p>
  
  <pre><code>sql = "EXECUTE stmt USING \'{}\', \'{}\', {}, {};".format(d, t, tag, power)
  self.cursor.execute(sql)
  </code></pre>
  
  <p>And in the loop I get:</p>
  
  <pre><code>MySQL Error [1064]: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''2014-12-25', '12:31:46', 88000000, -6.64' at line 1
  </code></pre>
  
  <p>What's going on?</p>