Mysql Rows Delete When Program Exits
I'm using Python and MySQLdb to add rows to my database. It seems that when my script exits, the rows get deleted. My last lines before the script exits do a 'select *' on the ta
Solution 1:
Looks like you need to connection.commit()
your changes after you execute the query (replace connection
with your DB connection variable).
http://docs.python.org/library/sqlite3.html
Connection.commit(): This method commits the current transaction. If you don’t call this method, anything you did since the last call to commit() is not visible from other database connections. If you wonder why you don’t see the data you’ve written to the database, please check you didn’t forget to call this method.
Solution 2:
Check this other question: Python MySQLdb update query fails
You can find some examples on how to commit, how to connect using autocommit, etc.
Post a Comment for "Mysql Rows Delete When Program Exits"