i just committed the two warnings just now.


On Jan 15, 2009, at 12:49 PM, GustaV wrote:

>
> Is it planned for 0.6? or earlier?
>
> Anyway thanks: I stop trying all the combinations right now! :)
>
> On 15 jan, 18:30, Michael Bayer <[email protected]> wrote:
>> There's various error conditions we should have added in 0.5 but have
>> not.   We should look into raising warnings in 0.5 and raising errors
>> in 0.6.  The conditions are, using "delete-orphan" without "delete",
>> and using "delete-orphan" with "secondary".   Neither is supported at
>> this time.
>>
>> On Jan 15, 2009, at 11:30 AM, GustaV wrote:
>>
>>
>>
>>> Hi all,
>>> I try to set up a many-to-many relation with an association object.
>>
>>> But I want something not usual: I want the child object deleted when
>>> not owned by any parent anymore.
>>> This is for a messages/recipients relation: the message is useless
>>> when everybody removed it from its mailbox!
>>
>>> I tried that, but it doesn't work:
>>
>>> class Parent(meta.DeclarativeBase):
>>>   id = Column(types.Integer, primary_key=True)
>>
>>> class Child(meta.DeclarativeBase):
>>>   id = Column(types.Integer, primary_key=True)
>>
>>> class Assoc(meta.DeclarativeBase):
>>>   p_id = Column(types.Integer,
>>>                 ForeignKey(Parent.id))
>>>   c_id = Column(types.Integer,
>>>                 ForeignKey(Parent.id))
>>
>>>   parent = relation(Parent,
>>>                     backref=backref('children',
>>>                               cascade='all, delete-orphan'))
>>>   child = relation(Child,
>>>                    backref='parents',
>>>                    cascade='delete-orphan')
>>
>>> I expect "child = relation(Child, backref='parents',  
>>> cascade='delete-
>>> orphan')" to forward deletes to child when it is an orphan. But it
>>> looks like it forward the delete even if it is not an orphan yet...
>>
>>> It that configuration:
>>
>>>  p1 = Parent()
>>>  p2 = Parent()
>>>  c = Child()
>>>  assoc1 = Assoc(parent=p1, child=c)
>>>  assoc2 = Assoc(parent=p2, child=c)
>>
>>> p1.children = [ ] will lead to:
>>> - delete assoc1 (ok)
>>> - delete c (not ok)
>>> - update assoc2.c_id = null (not ok)
>>
>>> So why is it not really a delete-orphan? :)
>>
>>> Thanks
>>
>>> GustaV
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to