title: Python cursor.execute() with MySQL UPDATE causes syntax error
body: <p>Following <a href="http://bobby-tables.com/python" rel="nofollow noreferrer">this</a> example I am attempting to rewrite code that works with code that protects against SQL injection:</p>
  
  <p>Code that works:</p>
  
  <pre><code>table = "led_status"
  field = "test_led"
  value = "FALSE"
  
  cursor.execute(("UPDATE %s SET %s = %s") % (table, field, value))
  </code></pre>
  
  <p>code that does not work:</p>
  
  <pre><code>table = "led_status"
  field = "test_led"
  value = "FALSE"
  
  cursor.execute(("UPDATE %s SET %s = %s", table, field, value))
  </code></pre>
  
  <p>Nor does this code work:</p>
  
  <pre><code>table = "led_status"
  field = "test_led"
  value = "FALSE"
  
  sql_update_command = "UPDATE %s SET %s = %s"
  cursor.execute(sql_update_command, (table, field, value))
  </code></pre>
  
  <p>The first example works, the others do not and each of them throw this syntax error:</p>
  
  <pre><code>mysql.connector.errors.ProgrammingError: 1064 (42000): 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 ''led_status' SET 'test_led' = 'FALSE'' at line 1
  </code></pre>
  
  <p>I am not sure what I am doing wrong so any pointers would be greatly appreciated. </p>