报错如下
pymysql.err.ProgrammingError: (1064, “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 ‘CID = ‘10008104’’ at line 1”)
原来:
cursor.execute(“UPDATE ingredients set FORMULA = %s WHERE CID = %s”,
(compound.molecular_formula, str(CID[i][0])))
改为:
cursor.execute(‘UPDATE ingredients set FORMULA = %s WHERE CID = %s’,
(compound.molecular_formula, str(CID[i][0])))
双引号改为单引号!!