On Feb 1, 3:02 pm, "Kumar McMillan" <[EMAIL PROTECTED]> wrote: > I have a program that is entering a deadlock (pyscopg) after an > exception since the test suite tries to delete stuff as part of > cleanup. I tried wrapping everything in a transaction to be sure a > rollback is called but it *appears* that when I start using > transaction.session.bind_to.execute(stmt) directly, it is not part of > the transaction.
uh yeah...why would it be ? youre essentially pulling out the original bind_to engine which has no idea about what particular connection/transaction is used by the SessionTransaction. unless youre playing with the "threadlocal" engine (which i would advise is not worth it), why not do what the docs say ? http://www.sqlalchemy.org/docs/unitofwork.myt#unitofwork_transaction_sql > > All I'm doing are selects anyway (this may be why the transaction is > ignored too) so I really don't need a transaction to begin with. How > do I set an engine of a session to autocommit? any execute() that you call from an engine or connection without an associated transaction will call commit for you, *if* you did something like an INSERT/UPDATE/DELETE/etc. it does not call commit if you just call a "select". it actually looks at the string you executed to determine this. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
