[Grok-dev] Re: megrok.rdb updated

Laurence Rowe l at lrowe.co.uk
Thu Jun 26 06:32:59 EDT 2008


Martijn Faassen wrote:
> Sebastian Ware wrote:
>> 25 jun 2008 kl. 17.15 skrev Martijn Faassen:
>>
>>> They are two operations though: adding an object to the relational 
>>> database and changing the record so it's added to the container.
>>
>> Does this require two writes to the db? (hoping not...)
> 
> No, I think the writing happens at the end of the Zope transaction, just 
> like it does with the ZODB. That said, I'm not sure what the SQL looks 
> like.

I think that you may need two round trips to support auto-generated 
primary keys. In collective.tin I do something like this:


    session = rdb.Session()
    session.add(department)
    session.flush()
    self.context.set(department)

Laurence



More information about the Grok-dev mailing list