On Jan 2, 2009, at 1:08 PM, Andreas Jung wrote:

> On 02.01.2009 18:11 Uhr, Michael Bayer wrote:
>>
>> On Jan 2, 2009, at 4:24 AM, Andreas Jung wrote:
>>
>>> Hi there,
>>>
>>> running SA 0.5rc4, psycopg2 together with Postgres 7.4.22.
>>>
>>> I am currently migrating a Zope application from SA 0.3 to SA 0.5.
>>> While the migration worked for a bigger application I have an issue
>>> with a smaller application. SA issues a "SAVEPOINT XXX" command
>>> although
>>> Postgres 7.4 obviously does not support savepoints.
>>
>>
>> SAVEPOINT is only issued if you do so explicitly, via begin_nested()
>> on Session or Connection.   You'll have to modify your application to
>> not use these methods.
>
> This is not true. According to the traceback, being_nested() is called
> from within SA itself.

The SQLAlchemy session does not acquire a connection or issue any  
transactional instructions until the first SQL within the session's  
current transactional scope is emitted; in this case it's a flush().    
SQL is not necessarily emitted at the point at which begin_nested() is  
called.   When the flush() (or any other kind of SQL execution) is  
called, the current transactional stack is processed which includes  
issuing SAVEPOINT for any SessionTransactions with nested=True.   Most  
supported backends do not implement SAVEPOINT so it wouldn't be  
feasable if the Session's design required SAVEPOINT to be present.

If you'd like to see this for yourself, just run this program:

from sqlalchemy import *
from sqlalchemy.orm import *

engine = create_engine('postgres://scott:ti...@localhost/test',  
echo=True)
sess = sessionmaker(bind=engine)()
sess.begin_nested()

print "Begin nested has been called."

sess.execute("SELECT 1")




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