the ROLLBACK at the connection pool is issued below the level of the  
Connection/Engine so is currently not logged but definitely occurs.    
if you're relying on connectionless execution, the connection is  
pulled from the pool for the single statement you're executing, is  
used only by your statement and not accessible to any other threads  
while checked out, and then immediately returned after use, where the  
ROLLBACK occurs.

On Jan 15, 2009, at 3:07 AM, Shawn Church wrote:

> For performance reasons I am converting some operations from ORM to  
> SQL Expression syntax.  In other words instead of session.query(...)  
> I'm now using select(...).execute().  This has led to  a couple of  
> questions:
>
> 1) I was relying on thread local sessions to handle all the ugly  
> details for me when executing multiple concurrent operations. When  
> executing a select statement directly,  do I still get a separate  
> connection per thread?  By enabling connection pool logging it  
> APPEARS that I do. Is this correct or should I user  
> session.execute(...) instead (even though I do not require  
> transactions for these statements)?
>
> 2) When I close a session,  the documentation says that the SQL  
> transaction is rolled-back but I do not see this if I enable  
> logging.  For example,  if I do:
>
> MyClass.get(1)  # Elixr method,  same as session.query(MyClass).get(1)
> session.close()
>
> I get log output like:
>
> 2009-01-14 23:26:08,664 - sqlalchemy - INFO - Connection  
> <_mysql.connection open to '192.168.0.1' at 999baf4> checked out  
> from pool
> 2009-01-14 23:26:08,665 - sqlalchemy - INFO - BEGIN
> 2009-01-14 23:26:08,671 - sqlalchemy - INFO - SELECT .... (truncated  
> for brevity)
> 2009-01-14 23:26:08,763 - sqlalchemy - INFO - Connection  
> <_mysql.connection open to '192.168.0.1' at 999baf4> being returned  
> to pool
>
> Should I be worried that there is not an explicit ROLLBACK generated  
> or is that handled when the connection is returned to the pool?
>
> Thanks in advance,
>
> Shawn
>
> >


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to