On Tue, Jul 21, 2009 at 1:10 PM, Jon Nelson<jnel...@jamponi.net> wrote: > On Tue, Jul 21, 2009 at 10:47 AM, Michael Bayer<mike...@zzzcomputing.com> > wrote: >> >> Jon Nelson wrote: >>> >>> I encountered an odd issue today that I can't explain, and it seems like a >>> bug. >>> I've checked 0.5.4p2 and 0.5.5, and the behavior is the same. >> >> its a mistake I've seen before. Backrefs change the collection, so the >> iteration ends up granting only every other item. >> >> # solution >> for child in list(root.children): >> child.parent = new_root ...
>> also the root.parent = root thing will require post_update, see the mapper >> docs for this. I tried using post_update today, both True and False, and maybe I'm just using it wrong. The parent_id is NOT NULL and has no default. Doing something like this doesn't seem to help, with or without the post_update=True (or False) configured on the mapper. node = Node() node.parent = node sess.add(node) sess.flush() The parentid attribute is always None. Is there an easy way to fix this? -- Jon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---