On Oct 2, 2012, at 5:01 PM, George Sakkis wrote:

> On Oct 2, 10:39 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> 
>> On Oct 2, 2012, at 4:29 PM, George Sakkis wrote:
>> 
>>> I had the impression that the Session’s unit of work figures out
>>> automatically the potential object dependencies and makes sure that
>>> the insertion order is consistent to a topological sort but apparently
>>> I misunderstood. I postedhttps://gist.github.com/3822855as an
>>> example.
>> 
>>> In the first case (object_lists = [authors, books]), first a bunch of
>>> Authors is committed and then a bunch of Books. As expected this
>>> always succeeds. The next two cases though where authors and books are
>>> commited at once may or may not succeed. Why it doesn't use the
>>> topological sort of the tables and why it is not deterministic?
>> 
>> on a quick glance I see no usage of relationship().  The topological sort is 
>> based on the relationship() paths built between mappers, not the foreign 
>> keys.
> 
> Ah, I see. Out of curiosity, why it's not consistent across runs (i.e.
> always fail)?
> 
> Thanks for the super prompt reply!

if I had to guess it would be because the topological sort relies upon Python 
sets and therefore dictionary ordering, which is non-deterministic.


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

Reply via email to