[Zope] Transactions

Chris McDonough chrism@digicool.com
Thu, 10 Aug 2000 09:35:52 -0400


Kapil,

I don't know if you've run across this yet, but the method call:

get_transaction()

In Python (after you've imported the ZODB module) returns the result of
the get_transaction global, which helps do some transaction-related
things:

get_transaction().commit()
get_transaction().abort()
get_transaction().note()

There are also semantics for committing subtransactions, though I'm not
real clear on them.  I *think* you commit a subtransaction by doing:

get_transaction().commit(1)

See Jim's ZODB UML model at
http://www.zope.org/Documentation/Developer/Models/ZODB for more info.

You could probably emulate what you need to do with a combination of
these commands.

> -----Original Message-----
> From: Kapil Thangavelu [mailto:kthangavelu@earthlink.net]
> Sent: Wednesday, August 09, 2000 4:59 PM
> To: zope@zope.org
> Subject: Re: [Zope] Transactions
> 
> 
> Let me a bit more specific.
> 
> i'm developing a python product which does some fairly intensive list
> processing over a long list and adds stuff to the zodb based 
> on that. If
> it bombs somewhere in the middle of the processing i don't want the
> whole transaction rolled back. i'm doing my own data 
> integrity check so
> i want each add to be atomic independent of the transaction. i thought
> about sub-transactions to get around the enormous mem requirements of
> the huge transactions but it doesn't solve the problem of atomic adds.
> is there some way to either turn off transactions for a given python
> operation or to make an operation autocommit itself in a 
> subtransaction?
> 
> hmmm... related question (i think) how does one make a method whose
> effect can't be rolled back?
> 
> any help appreciated
> 
> Kapil
> 
> Kapil Thangavelu wrote:
> > 
> > quick question.
> > 
> > Is there a way to turn off transactions for a given python 
> operation?
> > 
> > Kapil
> > 
> > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists -
> >  http://lists.zope.org/mailman/listinfo/zope-announce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>