Pymysql Insert Into not working Pymysql Insert Into not working python python

Pymysql Insert Into not working


PyMySQL disable autocommit by default, you can add autocommit=True to connect():

conn = pymysql.connect(    host='localhost',    user='user',    passwd='passwd',    db='db',    autocommit=True)

or call conn.commit() after insert


You can either do

  • conn.commit() before calling close

or

  • enable autocommit via conn.autocommit(True) right after creating the connection object.

Both ways have been suggested from various people at a duplication of the question that can be found here: Database does not update automatically with MySQL and Python