Could something be added to the docs then to elaborate on how the context 
manager works in regards to how things are committed/rolledback ?

I just added comments to the existing 
example  ( 
http://docs.sqlalchemy.org/en/rel_0_8/orm/session.html?highlight=begin_nested#using-savepoint
 
)


-------

for record in records:
    try:
    # start the context manager
        with session.begin_nested():
            session.merge(record)
            # if not exception is raised, the savepoint is automatically 
released
    except:
        # if an exception is raised, the savepoint is automatically rolled 
back
        print "Skipped record %s" % record

# commit the actual session
session.commit()

        

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to