Hi,

On 11     , 04:02, Michael Bayer <[EMAIL PROTECTED]> wrote:
> 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.

i had similar need to order things prev week. I thought that may be in
the future there will be possible to define some artificial dependency
(similar to relation) that have no its counterpart in the database in
order to meet similar requrements - this will add just one, two
dependencies to the topological sort and will not slow down much the
commit process. what is your opinion, Michael?

such requirement arose for me trying to fill some cache table (CT)
when some other table(OT) is changed. Before i made the relation OT-CT
it sometimes tried to update in CT before the change in OT is done.

regards,
stefan


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to