Michael, On Mar 25, 3:00 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote: > SQLAlchemy also doesn't issue BEGIN. You might want to look at setting > autocommit to false on your MySQLdb connection, since that's the layer that > would be sending out BEGIN.
I looked into this. BTW, I use SQLAlchemy v 0.5 in a corporate environment, and upgrading is expensive (time/effort). My belief that 0.5 issued BEGIN statements was based on inspection of the echo log i.e. create_engine(..., echo=True). I thought that the echo log was a transparent trace of the exact statements sent to the server. Upon further investigation, that seems not the case. The BEGIN statements appear in the echo log, but they don't show up in the mysqld server log. We can see why at line 984 of engine/base.py [ http://www.sqlalchemy.org/trac/browser/lib/sqlalchemy/engine/base.py#L984 ] 982 def _begin_impl(self): 983 if self._echo: 984 self.engine.logger.info("BEGIN") 985 try: 986 self.engine.dialect.do_begin(self.connection) 987 except Exception, e: 988 self._handle_dbapi_exception(e, None, None, None, None) 989 raise Therefore, I am no longer worried about the emission of BEGIN. However, inspecting the mysqld general query log [ http://dev.mysql.com/doc/refman/5.0/en/query-log.html ], I noticed a bunch of ROLLBACK statements. 8 Query INSERT INTO xxx (yy, zzzzzzz) VALUES (NULL, 'foobar') 8 Query commit 8 Query rollback 8 Query INSERT INTO jjj (yy, zzzzzzz, aaaaa, bbbb, ccc, dd, eeeeee, fff... 8 Query commit 8 Query rollback 8 Query UPDATE jjj SET aaaaa=1, bbbb=2, ccc=1, dd=now() WHERE jjj.zzzzzzz = 193 8 Query INSERT INTO lll (dd, zzzzz, xxxx, ssssss, tttt, wwwww, uuu) VALUES ('2010-03-15... 8 Query INSERT INTO pppppppp (yy, nnnnnn) VALUES (NULL, 'barfoo') 8 Query commit 8 Query rollback Every COMMIT is followed by a ROLLBACK, which appears wasteful. Which software do I blame for that, SQLAlchemy or the MySQLdb DBAPI connector? Thanks, Keith -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.