[Buildbot-devel] sqlalchemy putting several operations into transactions

Dustin J. Mitchell dustin at v.igoro.us
Thu Nov 21 15:26:42 UTC 2013


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
>




More information about the devel mailing list