Re: [SQLObject] More transaction troubles
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Randall R. <ra...@ra...> - 2003-09-07 10:00:06
|
On Saturday, September 6, 2003, at 02:07 PM, Ian Bicking wrote: > On Saturday, September 6, 2003, at 03:58 AM, Randall Randall wrote: >> Okay, so I got the current CVS, but transactions >> still seem to not work. :) >> >> >>> r = Person.new(firstName='my', lastName='lastname', >> connection=trans) >> >>> r.firstName = 'Bob' >> >>> trans.commit() >> >>> r.firstName = 'Billy' >> >>> trans.rollback() >> >>> print r.firstName >> Billy > > Hmmm... that's odd. Maybe you should give debug=1 to your original > connection and see what SQL is being sent. Okay I did that, and all the SQL looks sane. It appears (from reading source) that Transaction() just passes through any commit() or rollback() it gets to psycopg (in this case), so there isn't any SQL generated from a rollback(). I noticed that there's an "autoCommit" keyword for PostgresConnection(), and the comments imply that it should be turned on for transactions to work, but using it send a "pool" keyword to DBAPI.__init__(), and thence to DBConnection.__init__(), which doesn't expect it. Using the query method of Transaction(), I can see that commit() and rollback() are working okay; I think the reason that transactions didn't appear to work, above, is that SQLObject.new() just ignores the 'connection' keyword (and perhaps that's what it's supposed to do?). Setting _connection to the transaction in the class definition does seem to work, with the exception that a lot of stuff isn't defined for Transaction() that is supposed to be there for a _connection, like '_SO_selectOne', 'queryInsertID', etc. >> AttributeError: 'Transaction' object has no attribute '_SO_selectOne' > > Well, that's just a bug. I'll look into it, I think I have a fix. > Of course it will go into CVS and you won't be able to check it for a > day. Okay. -- Randall Randall <ra...@ra...> "You assist an evil system most effectively by obeying its orders and decrees." -- Mahatma Gandhi "When you advocate any government action, you must first believe that violence is the best answer to the question at hand." -- Allen Thornton |