[Grok-dev] Re: STORM howto

Christian Klinger cklinger at novareto.de
Fri Mar 14 05:29:23 EDT 2008

Wichert Akkerman schrieb:
> Previously Christian Klinger wrote:
>> Sebastian Ware schrieb:
>>> Do I add nva.stormcontainer in setup.py in order to fetch this egg? I 
>>> would like to try it.
>> Yes this should do it. Hopefully...
>>> Also, is there any way I can control the commits? I am basically doing:
>>> for obj in objlist:
>>>    ormContainer['id'] = obj
>> In the stormcontainer there is a __setitem__ which is responsible for 
>> the insert.
>>     def __setitem__(self, name, item):
>>         store = getUtility(IZStorm).get(self.getStoreUtilityName())
>>         store.add(item)
>>         transaction.commit()
>> The transaction.commit() fires also an rdb.commit. This means on every 
>> insert there is a commit.
>> But maybe it is possible to delete the transaction.commit() in 
>> __setitem__, and rely on zopes transaction.commit.?
> I do not think any library or framework should ever do a commit itself.
> You should hook properly into the zope transaction manager. Any
> premature commit can result in inconsistent or erroneous data in your
> database. And reducing the number of commits will have a huge impact on
> performance.

Hi Wichert,

thx for this info. I will delete the transaction.commit() run the tests. 
and see if it works again... :-))


> Wichert.

More information about the Grok-dev mailing list