On Feb 11, 2011, at 4:32 AM, Romy wrote: > Fair enough, though it appears to be a little inconsistent and thus > confusing, since I do see COMMIT statements in the log output.
we call connection.commit() and we log the phrase "COMMIT" in the output. > > For instance, rearranging the below to: > > user = User.query.filter_by(id=1).first() > user.x = user.x + 1 > elixir.session.commit() > > results in a BEGIN, SELECT, UPDATE, COMMIT log output. When I > introduce another query before the commit, the COMMIT is never > printed. That's just something specific to what your code is doing. If you call commit(), and there's a transaction in progress, and it doesn't throw an exception, you'll see COMMIT in the logs. If you're still playing around with autocommit=True, there's no transaction unless you just called begin(). > > On Feb 10, 9:14 am, Michael Bayer <[email protected]> wrote: >> On Feb 10, 2011, at 6:10 AM, Romy wrote: >> >> >> >> >> >> >> >> >> >>> I am testing autocommit=False, and the output pattern is consistently >>> missing a COMMIT. I don't quite understand what SQLAlchemy is doing in >>> its debug output, unless it's not printing everything that goes to >>> MySQL. Specifically, for code that looks like this: >> >>> user = User.query.filter_by(id=1).first() >>> user.x = user.x + 1 >>> emails = Emails.query.filter_by(user=user).all() >>> elixir.session.commit() >>> elixir.session.remove() >> >>> I get this info-level debug output: >> >>> BEGIN >>> SELECT user >>> UPDATE user >>> SELECT emails >> >>> And no COMMIT in sight. The database does appear to get updated... not >>> sure what's happening ? >> >> MySQL MyISAM tables, the default, have no transactional behavior and all >> data is committed upon INSERT. >> >> >> >> >> >> >> >> >> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "sqlalchemy" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group >>> athttp://groups.google.com/group/sqlalchemy?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
