[Buildbot-devel] sqlalchemy putting several operations into transactions
mariangemarcano at gmail.com
Fri Nov 22 13:20:00 UTC 2013
Actually I've try this
conn.execution_options(autocommit = False).execute(q, [dict(brid=id,
for id in brids])
raise sa.exc.IntegrityError("Something went wrong")
I'm raising an exception right after conn.execute and before calling
transaction.commit() and the row still gets inserted into
the buildrequest_claims table
and it didn't work either and couldn't find an example in the codebase
where we disable the autocommit
On Fri, Nov 22, 2013 at 11:06 AM, Maria Marcano
<mariangemarcano at gmail.com>wrote:
> Yes, I'm looking at the log and the table itself when I raise an exception
> the data gets inserted before calling transaction.commit() unless I
> explicitly disable autocommit.
> this happens for example when running claimBuildRequests
> Could you point me to a place in the code where we disable autocommits to
> run a transaction ?
> On Thu, Nov 21, 2013 at 4:26 PM, Dustin J. Mitchell <dustin at v.igoro.us>wrote:
>> This is a great question. There are some places in Buildbot's code
>> that assume connection.begin() disables autocommit, so if that's not
>> the case, then we have some fixes to do.
>> I assume you've looked at query logs and seen commits before
>> trans.commit() was called?
>> On Thu, Nov 21, 2013 at 9:46 AM, Maria Marcano
>> <mariangemarcano at gmail.com> wrote:
>> > 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
>> > raise
>> > I also need to specify
>> > .execution_options(autocommit=False)
>> > Is this the right approach (specifying autocommit=False) on each
>> > or am I missing something?
>> > Thanks,
>> > Maria.
>> > Shape the Mobile Experience: Free Subscription
>> > Software experts and developers: Be at the forefront of tech innovation.
>> > Intel(R) Software Adrenaline delivers strategic insight and
>> > conversations that shape the rapidly evolving mobile landscape. Sign up
>> > _______________________________________________
>> > Buildbot-devel mailing list
>> > Buildbot-devel at lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/buildbot-devel
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the devel