On Nov 10, 2007, at 4:54 PM, Manlio Perillo wrote:
> Isn't it possible to just use the order used by the programmer? > If I call > save(A) > save(B) > the order of save() is signficant for instances of one class: save(A1) save(A2) will insert A1 and A2 in that order. but beyond that, the order is determined by the topological sort of all mappers. if you save objects of type A, B, C and D, B is dependent on A, D is dependent on C, and by "dependent" i mean they have relation()s set up; it might say for the ordering: A B C D. But you saved the objects in this order: save(C1) save(D1) save(B1) save(A1) save(C2). now the order of your save()'s is in conflict with what the topological sort requires - it *cannot* save C2 where its being saved if D1 is dependent on it - if it put D1 at the end, now D1 is being saved after A1, etc. and your ordering is out the window. Also, by default the topological sort is only sorting at the level of tables, not rows - when row-based dependencies are detected, complexity goes up and the efficiency of the flush() goes down. so no, its not at all workable for save()'s to determine the order across classes - in any realistic scenario they will conflict with the topological sort. youre basically suggesting that SA would do "half" of a topological sort and you'd do the other half manually, but it doesnt work that way. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
