[Buildbot-devel] sqlalchemy putting several operations into transactions
Maria Marcano
mariangemarcano at gmail.com
Fri Nov 22 10:06:08 UTC 2013
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
https://github.com/buildbot/buildbot/blob/master/master/buildbot/db/buildrequests.py#L127
Could you point me to a place in the code where we disable autocommits to
run a transaction ?
Thanks,
Maria
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?
>
> Dustin
>
> 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
> 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.
> >
> >
> ------------------------------------------------------------------------------
> > 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 game-changing
> > conversations that shape the rapidly evolving mobile landscape. Sign up
> now.
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> > _______________________________________________
> > 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...
URL: <http://buildbot.net/pipermail/devel/attachments/20131122/f0f4b613/attachment.html>
More information about the devel
mailing list