Am I interacting with the database correctly?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Jan 18 18:09:01 CET 2009


En Sun, 18 Jan 2009 13:54:06 -0200, John Fabiani <jfabiani at yolo.com>  
escribió:

> I have never worked with MySQL.  I do work with others.  The first part
> looks fine.  If you insert, update or delete then you need a 'commit' or
> a 'rollback'.  Preparing data for a report it is unlikely that you need  
> to
> commit or rollback anything.  After all you are only using 'select'.

Note that you have to commit/rollback a transaction *even* if you only  
execute select statements - at least when using isolation levels higher  
than "read uncommited".
By example, using "repeatable reads", a "select" on table A blocks any  
attempt to modify the involved rows until the transaction ends. And using  
"read commited", it won't see rows modified or added after the transaction  
began.

-- 
Gabriel Genellina




More information about the Python-list mailing list