[Twisted-Python] SELECT returns no results without conn.commit()

Franz Schwartau franz at electromail.org
Tue Jun 3 07:31:14 MDT 2014


Hi!

I'm trying to extend ppolicy (http://bimbo.fjfi.cvut.cz/ppolicy) a bit. ppolicy uses the twisted framework. On CentOS 6.5 version 8.2.0 of twisted is installed.

I wrote a separate module called LookupSessionDB:

http://pastebin.com/u4TMNhpd

It looks up some values from a database table. It does some efforts to handle reconnect properly.

If called a second time and more the SELECT statement returns no rows (line 138) if "conn.commit()" is missing in line 125. If "conn.commit()" is called after obtaining a database connection "rows = cursor.fetchall()" (line 138) returns the expected results.

The module inserting the records calls "conn.commit()" after INSERT. If I execute the same SELECT statement in a separate mysql client the results are displayed.

This is quite confusing. Any idea what's going on?

	Best regards
		Dirk




More information about the Twisted-Python mailing list