Why has MyISAM fixed this problem caused by InnoDB?

I got a very strange error in my Python on MySQL application. The following code was in a loop that was called many times. The code never caused errors, but also never added any data:

    cursor = db.cursor()
    cursor.execute("""
        INSERT INTO test_1 (value) VALUES (10000);
    """)

Another strange symptom was that inserting data into the same table using phpMyAdmin later produced very large auto_increment identifiers, so the auto_increment counter increased even if there was actually no data in the table (according to SELECT * FROM test_1). The inserts worked perfectly using the MySQL Workbench.

In the end, I accidentally discovered that using MyISAM on the table instead of InnoDB, I fixed it. Why?

+3
source share
1

, commit. MySQLdb ( , , ) , . auto_increment, phpMyAdmin, InnoDB , python. Python script , commit , ( auto_increment) . , db.commit() ( db ).

. PEP 249 Python.

+6

All Articles