[Grok-dev] Re: megrok.rdb updated
calvin at sixfeetup.com
Thu Jun 26 10:04:29 EDT 2008
Martijn Faassen wrote:
> * It turns out that using auto-generated primary keys as a container key
> doesn't look possible: this primary key is not assigned yet by the
> database by the time the container can be used. This means containers
> need an important re-think as this destroys the only sensible default
> behavior I can think of right now. This is a big problem and we need
> some way around it - there often is no other column in a database table
> that can function as a key.
I talked to the #sqlalchemy channel a bit on this and they seem to say
that auto-generated primary keys isn't the use case for
MappedCollections. I'm having the same issue in my grok app which isn't
using megrok.rdb yet, but mimics it quite closely.
In the end for now I have turned off cascading orphan deletes and handle
it in my delete methods so I can add a child object then add it to the
MappedCollection. This works, but is ugly.
It seems to me that SQLAlchemy should support adding new children to a
MappedCollection and the collection should handle the save, etc. for
you. Anyone else have any thoughts on how to get around this?
S i x F e e t U p , I n c . | "Nowhere to go but open source"
Silicon Valley: +1 (650) 401-8579 x602
Midwest: +1 (317) 861-5948 x602
mailto:calvin at sixfeetup.com
http://www.sixfeetup.com | Zope/Plone Custom Development
More information about the Grok-dev