Use pymysql timing query data is not updated causes and solutions

With python wrote a small script timed to query the database, query results and writes the output file and found that the results of each query are the same, but the actual data in the database update.

 

the reason:  

REPEATABLE READ
The default isolation level for InnoDB. It prevents any rows that are queried from being
changed by other transactions, thus blocking non-repeatable reads but not phantom reads.
It uses a moderately strict locking strategy so that all queries within a transaction see
data from the same snapshot, that is, the data as it was at the time the transaction started.

Repeatable read

Innodb default isolation level. It prevents any lines of inquiry

Changed by other transactions, thus preventing non-repeatable reads, but does not prevent phantom reads.

It uses moderately stringent lockout policy, so that all queries affairs can be seen

Data from the same snapshot of the data at the time of the transaction that is initiated.

 

Now that the transaction is not updated because the query caused it to solve the chant:

  Each update about the affairs inquiry, conducted commit after the execute (sql) () operation

  

  

Guess you like

Origin www.cnblogs.com/wangbaojun/p/11505540.html