title: What is the cause of mysqldb's Warning: Truncated incorrect DOUBLE value error?
body: <p>I am getting many warnings of the same kind -- </p>
  
  <pre><code>Warning: Truncated incorrect DOUBLE value: '512121500B'
  </code></pre>
  
  <p>-- but cannot figure out why.</p>
  
  <p>The MySQL table dr_snapshot looks like this:</p>
  
  <pre><code>PremiseID char(10) Primary Key
  cycle SMALLINT(6)
  last_read DATETIME
  reading INTEGER
  DeviceID INTEGER
  </code></pre>
  
  <p>I want to delete many rows by PremiseID. Here is one in particular: '512121500B'.</p>
  
  <p>Here is my Python function that deletes by PremiseID:</p>
  
  <pre><code>def delDrSnapRow(premiseID, db):
      sql_cmd = " ".join([
          "delete ",
          "from dr_snapshot ",
          "where PremiseID = " + str(premiseID) + " ; "])
  
      del_cur = db.cursor()
      rc = del_cur.execute(sql_cmd)
      del_cur.close()
  
      return rc
  </code></pre>
  
  <p>PremiseID is a string, not a double. What am I missing here?</p>
  
  <p>Many thanks.</p>
  
  <h2>Edit</h2>
  
  <p>After modifying my delete procedure to use try: .. except, I am not seeing the warning. I believe I am not seeing the warning, because I'm not seeing the warning display -- <code>print(e)</code> -- in the except part. </p>
  
  <p>I am left with the conclusion that the try: except somehow removed the error.</p>
  
  <pre><code>def delDrSnapRow(premiseID, db):
      sql_cmd = " ".join([
          "delete ",
          "from dr_snapshot ",
          "where PremiseID = " + "'" + premiseID + "' ; "])
  
      del_cur = db.cursor()
  
      try:
          rc = del_cur.execute(sql_cmd)
  
      except MySQLdb.Error, e:
          print "Error %d: %s" % (e.args[0], e.args[1])
  
      except MySQLdb.Warning, e:
          print(e)
          rc = del_cur.execute(sql_cmd)
  
      del_cur.close()
  
      return rc
  </code></pre>