[Buildbot-devel] sqlalchemy putting several operations into transactions

Maria Marcano mariangemarcano at gmail.com
Thu Nov 21 14:46:22 UTC 2013


Hi,

I'm looking at putting some operations into transactions for some
customizations that I'm working on.

but I'm noticing that by default it auto commits

Even if I have something like the following

    trans = connection.begin() # open a transaction - this runs in the
context of method_a's transaction
    try:
        connection.execute("insert into mytable values ('bat', 'lala')")
        connection.execute(mytable.insert(), col1='bat', col2='lala')
        trans.commit()
    except:
        trans.rollback() # this rolls back the transaction unconditionally
        raise


I also need to specify

.execution_options(autocommit=False)


Is this the right approach (specifying autocommit=False) on each statement
or am I missing something?

Thanks,
Maria.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20131121/0518b61e/attachment.html>


More information about the devel mailing list