On 02/01/2013 11:08 AM, Michael Bayer wrote:

> On Feb 1, 2013, at 1:02 PM, [email protected] <mailto:[email protected] 
> <[email protected]> wrote:

>> When I delete[*1] a mapped object (a Title()) that is on the many>> side of 
>> a 1:m relationship (in sqlalchemy 0.8.0b2, Python 3.3), I>> get the 
>> following error when I do a session.commit():>> >> [...earlier part of 
>> traceback elided...] File>> 
>> "/usr/local/lib/python3.3/site-packages/sqlalchemy/orm/sync.py",>> line 53, 
>> in clear (r, orm_util.state_str(dest)) AssertionError:>> Dependency rule 
>> tried to blank-out primary key column 'title.work'>> on instance '<Title at 
>> 0xb5130d8c>'

> > you need to specify delete-orphan cascade for a PK/FK child object,> so 
> > that the object is marked as deleted (regardless of whether or not> ON 
> > DELETE CASCADE ultimately handles it).  See> 
> > http://docs.sqlalchemy.org/en/rel_0_8/orm/tutorial.html#configuring-delete-delete-orphan-cascade

Thanks, that works well.  FWIW (in the way of feedback),
I had read the section on cascades at
  http://docs.sqlalchemy.org/en/rel_0_8/orm/session.html#unitofwork-cascades
but not carefully because it describes "...how operations 
performed on a parent object relative to a particular Session 
should be propagated to items referred to by that relationship".  

Since I was not doing any operations on the "parent" object 
(I was deleting a "child" object), I interpreted that as 
saying the cascades argument was not relevant to my case.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to