title: mysql/connector python query works in mysql but not python
body: <p>I've seen the following two answers:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/24131196/python-mysql-query-not-working">python - mysql query not working</a></li>
  <li><a href="https://stackoverflow.com/questions/11705450/sql-query-works-in-console-but-not-in-python">SQL query works in console but not in python</a></li>
  </ul>
  
  <p>And neither of the solutions work for me. I'm running the code below which completes without any errors every single time yet does not at all modify the mysql table <code>Compounds</code>, and I've verified that the format of the input file matches exactly the format of my mysql table and that it is correctly delimited and not empty.</p>
  
  <pre><code>import os, sys
  import mysql.connector
  from mysql.connector import errorcode
  from mysql.connector.constants import ClientFlag
  
  TABLE_NAME = "Compounds"
  fullDataFile  = "data/compounds/parsed/fullData.csv"
  cnx = mysql.connector.connect(user='kharland', passwd='password', db='mydb', client_flags=[ClientFlag.LOCAL_FILES])
  cursor = cnx.cursor()
  print "loading data file: %s/%s" % (os.getcwd(), fullDataFile)
  try:
    cursor.execute = (
      "LOAD DATA LOCAL INFILE '%s/%s'"
      " REPLACE"
      " INTO TABLE `%s`"
      " FIELDS TERMINATED BY '^'"
      " LINES TERMINATED BY '\n'"
      " (PUBCHEM_COMPOUND_CID,"
      " PUBCHEM_COMPOUND_CANONICALIZED,"
      " PUBCHEM_CACTVS_COMPLEXITY,"
      " PUBCHEM_CACTVS_HBOND_ACCEPTOR,"
      " PUBCHEM_CACTVS_HBOND_DONOR,"
      " PUBCHEM_CACTVS_ROTATABLE_BOND,"
      " PUBCHEM_CACTVS_SUBSKEYS,"
      " PUBCHEM_IUPAC_INCHI,"
      " PUBCHEM_IUPAC_INCHIKEY,"
      " PUBCHEM_EXACT_MASS,"
      " PUBCHEM_MOLECULAR_FORMULA,"
      " PUBCHEM_MOLECULAR_WEIGHT,"
      " PUBCHEM_OPENEYE_CAN_SMILES,"
      " PUBCHEM_OPENEYE_ISO_SMILES,"
      " PUBCHEM_CACTVS_TPSA,"
      " PUBCHEM_MONOISOTOPIC_WEIGHT,"
      " PUBCHEM_TOTAL_CHARGE,"
      " PUBCHEM_HEAVY_ATOM_COUNT,"
      " PUBCHEM_ATOM_DEF_STEREO_COUNT,"
      " PUBCHEM_ATOM_UDEF_STEREO_COUNT,"  
      " PUBCHEM_BOND_DEF_STEREO_COUNT,"
      " PUBCHEM_BOND_UDEF_STEREO_COUNT,"
      " PUBCHEM_ISOTOPIC_ATOM_COUNT,"
      " PUBCHEM_COMPONENT_COUNT,"
      " PUBCHEM_CACTVS_TAUTO_COUNT);"  %
      (os.getcwd(), fullDataFile, TABLE_NAME))
    cnx.commit()
  except mysql.connector.Error as e:
    sys.stderr.write("x Failed loading data: {}\n".format(e))
  </code></pre>
  
  <p>However if I print this query to terminal and then run it in mysql then it works just fine. Is there a reason the mysql lib might fail to run the actual query or am I missing some function call?</p>