This is a question mostly for my understanding of how the system works. I am using mysql.connector
to update my databse from Python.
import mysql.connector as mariadb
mariadb_connection = mariadb.connect(
user='testdb',
password='testdb',
database='testdb',
host='127.0.0.1',
)
cursor = mariadb_connection.cursor()
cursor.execute( "UPDATE testdb SET descr='konijn' WHERE number=14549")
mariadb_connection.commit()
mariadb_connection.close()
Before running mariadb_connection.commit()
, the update is not offical and I would not see the updated data in my database. My question is: after running cursor.execute
and before running mariadb_connection.commit()
, where is the information about the update stored? Is it still stored in the local machine's RAM or is it already somewhere in the MySQL databse, but not official shown yet until commit
is run?
CodePudding user response:
The changes are stored in an in-progress transaction in the MariaDB database server.
db.commit()
corresponds to the COMMIT
SQL statement.