Arnar Birgisson wrote:
Now, what I really wanted to do is to write a method on my class that takes care of changing it's primary key (or part of it, at least) and cascade the change down to the children of that entity. Would that be possible while keeping the process transparent to the caller, as far as removing the object from the identity map and re-adding it with the new key. I'm sorry if it sounds stupid, I don't have a full understanding of the identity map.
yeah see, thats exactly the kind of thing i dont want SA's ORM to get into, because its really thorny..updating the relationship on all child objects. at the very least, it requires loading them all in, cascading the change, etc. it gets pretty nuts and is not particularly scalable (similar to cascading deletes not being terribly scalable in SA either). the best way to cascade a change of PK like that is to set it on your database using ON UPDATE CASCADE, and just do an UPDATE statement. the DB takes care of the rest. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---