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.

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?

this is what it looks like (roughly)...


session = self.session_context.current
transaction = session.create_transaction()

# with the mapper (seems to be in transaction)
rs = session.query(mapped_class).select_whereclause(query_str)

# with a table object (does not seem to be in the transaction)
stmt = table.select(col==val)
engine = transaction.session.bind_to
engine.execute(stmt)

_

if I can set the engine to auto commit mode I will likely be able to
prevent the deadlock.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to