I have not yet completed differential diagnosis, but I was hoping someone had encountered a similar problem and could pass along a fix/workaround. The following program fails to do the writes -- import MySQLdb initdb='test' dbuser = 'root' dbpass = 'XXXXXX' host = 'localhost' connection = MySQLdb.connect( db=initdb, user=dbuser, passwd=dbpass, host=host ) cursor = connection.cursor() qd = "delete from test.data" cursor.execute(qd) qi = "insert into test.data values('ardvark', 'homework') " print qi cursor.execute( qi) q2 = "select * from test.data" cursor.execute( q2) res = cursor.fetchall() print res when run with Mysql-Python-1.2.1c under Python 2.4.2, but works just find with Mysql-Python-1.1.1 under Python 2.3.5. The tables are Innodb tables (that is, transactional). Running Zope with Python 2.4.2 and Mysql-Pyton 1.2.1c works just fine. Is there something special I need to do that I have forgotten? --
Dennis Allison wrote:
I have not yet completed differential diagnosis, but I was hoping someone had encountered a similar problem and could pass along a fix/workaround.
The following program fails to do the writes --
import MySQLdb initdb='test' dbuser = 'root' dbpass = 'XXXXXX' host = 'localhost' connection = MySQLdb.connect( db=initdb, user=dbuser, passwd=dbpass, host=host ) cursor = connection.cursor() qd = "delete from test.data" cursor.execute(qd) qi = "insert into test.data values('ardvark', 'homework') " print qi cursor.execute( qi) q2 = "select * from test.data" cursor.execute( q2) res = cursor.fetchall() print res
when run with Mysql-Python-1.2.1c under Python 2.4.2, but works just find with Mysql-Python-1.1.1 under Python 2.3.5.
The tables are Innodb tables (that is, transactional). 1.2.x has no autocommit, so you have to commit your changes with connection.commit() see e.g. https://sourceforge.net/forum/forum.php?thread_id=1329039&forum_id=70461
Running Zope with Python 2.4.2 and Mysql-Pyton 1.2.1c works just fine. ZMySQL commits for you, so this should work. BTW and just for the record: Python 2.4 is not recommended for Zope 2.8.x, but I'm sure you know that ;-)
Is there something special I need to do that I have forgotten?
HTH, Wolfram
Am Donnerstag, den 01.12.2005, 15:45 -0800 schrieb Dennis Allison:
I have not yet completed differential diagnosis, but I was hoping someone had encountered a similar problem and could pass along a fix/workaround.
The following program fails to do the writes --
import MySQLdb initdb='test' dbuser = 'root' dbpass = 'XXXXXX' host = 'localhost' connection = MySQLdb.connect( db=initdb, user=dbuser, passwd=dbpass, host=host ) cursor = connection.cursor() qd = "delete from test.data" cursor.execute(qd) qi = "insert into test.data values('ardvark', 'homework') " print qi cursor.execute( qi) q2 = "select * from test.data" cursor.execute( q2) res = cursor.fetchall() print res
I see no connection.commit() there. Zope always commits (if all successfull) when a request is done.
when run with Mysql-Python-1.2.1c under Python 2.4.2, but works just find with Mysql-Python-1.1.1 under Python 2.3.5.
This mysql-python-1.1.1 might have something like autocommit switched on. The readme or changes.txt of both versions should tell you that.
The tables are Innodb tables (that is, transactional). (more or less ;)
Running Zope with Python 2.4.2 and Mysql-Pyton 1.2.1c works just fine.
Regards Tino
participants (3)
-
Dennis Allison -
Tino Wildenhain -
Wolfram Kraus