Pymysql Insert Into not working
You can either do
conn.commit()
before callingclose
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
Did you commit it? conn.commit()
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