On Dec 10, 2007 4:13 PM, Matt Culbreth <[EMAIL PROTECTED]> wrote:
>
> Hello Friends,
>
> We've seen a problem with Elixir and deleting objects. We have a
> typical type relationship with a FK and cascading deletes, using
> Postgres.
>
> Upon deletion of a parent record in a FK relationship, rather than
> deleting the child record, elixir appears to be simply nulling the
> parent_id in the child record. Our model is something like:
>
> class Parent(Entity):
> has_many('children',of_kind='Child',inverse="parent")
>
> class Child(Entity):
>
> belongs_to('parent',of_kind='Parent',inverse='children',ondelete="CASCADE",required=True)
>
> Using sqlalchemy directly, the delete process appears to occur as
> expected, with the parent and corresponding child record(s) deleted.
Then you are not doing exactly the same thing with SQLAlchemy :) Now,
seriously, you forgot to use either the appropriate
"cascade" argument on the children relationship, or the
"passive_deletes" argument (or both), see:
http://www.sqlalchemy.org/docs/04/mappers.html#advdatamapping_relation_largecollections_passivedelete
Hope it helps,
> Using elixir the following error results:
>
> 'UPDATE child SET parent_id=%(parent_id)s WHERE child.id = %
> (child_id)s' {'child_id': 24, 'parent_id': None}
>
> Any ideas here? I can't see in the code why this is happening.
>
> Thanks,
>
> Matt
>
>
> >
>
--
Gaƫtan de Menten
http://openhex.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---