There was a small adjustment made to topological in beta3, which was erroneous 
and later reversed, that is a likely source of this.    Beyond that, 
unitofwork.py and topological.py had hardly changed for years.

But the big news is that all of topological.py and unitofwork.py have been 
rewritten from scratch in the current tip and will be in 0.6.0.   So that is 
where you should be right now.



On Apr 17, 2010, at 10:31 PM, percious wrote:

> Some things have changed in 0.6beta3 from beta2 and they are breaking
> my database loading script.  I don't yet have an example that causes
> this, but I am seeing an intermittent failure (sometimes when I run my
> program it's fine, without changing anything I'll run it again and it
> fails.)  I can show you the error, and describe that my model has a
> heckovalota inheritance.  Maybe you can decipher this message:
> 
> Traceback (most recent call last):
>  File "/Users/percious/clients/mvpss/mvp2.1/src/mvp2.1/bootalchemy/
> bootalchemy/loader.py", line 310, in from_list
>    session.flush()
>  File "/Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-
> packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/orm/session.py",
> line 1332, in flush
>    self._flush(objects)
>  File "/Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-
> packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/orm/session.py",
> line 1410, in _flush
>    flush_context.execute()
>  File "/Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-
> packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/orm/unitofwork.py",
> line 252, in execute
>    tasks = self._sort_dependencies()
>  File "/Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-
> packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/orm/unitofwork.py",
> line 285, in _sort_dependencies
>    [t.mapper for t in self.tasks.itervalues() if t.base_task is t]
>  File "/Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-
> packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/topological.py",
> line 43, in sort_with_cycles
>    return [(n.item, [n.item for n in n.cycles or []]) for n in
> _sort(tuples, allitems, allow_cycles=True)]
>  File "/Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-
> packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/topological.py",
> line 193, in _sort
>    lead = cycle[0][0]
> IndexError: list index out of range
> 
>> /Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/topological.py(193)_sort()
> -> lead = cycle[0][0]
> (Pdb) cycle
> []
> (Pdb) u
>> /Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/topological.py(43)sort_with_cycles()
> -> return [(n.item, [n.item for n in n.cycles or []]) for n in
> _sort(tuples, allitems, allow_cycles=True)]
> (Pdb) a
> tuples = set([(<Mapper at 0x23a8eb0; ContestEventTypeGroup>, <Mapper
> at 0x23b21f0; ContestEventType>), (<Mapper at 0x207a2d0; Resource>,
> <sqlalchemy.orm.dependency.MapperStub object at 0x2497950>), (<Mapper
> at 0x207a2d0; Resource>, <Mapper at 0x207a2d0; Resource>), (<Mapper at
> 0x207a2d0; Resource>, <sqlalchemy.orm.dependency.MapperStub object at
> 0x266d6f0>), (<Mapper at 0x238e9b0; ContestResource>,
> <sqlalchemy.orm.dependency.MapperStub object at 0x2664ef0>), (<Mapper
> at 0x207a2d0; Resource>, <Mapper at 0x238e9b0; ContestResource>),
> (<Mapper at 0x238e890; ContestType>, <Mapper at 0x23f30b0;
> Tournament>), (<Mapper at 0x207a2d0; Resource>, <Mapper at 0x23f30b0;
> Tournament>), (<Mapper at 0x23f30b0; Tournament>,
> <sqlalchemy.orm.dependency.MapperStub object at 0x2497ff0>), (<Mapper
> at 0x207a2d0; Resource>, <sqlalchemy.orm.dependency.MapperStub object
> at 0x268b2f0>), (<Mapper at 0x207a2d0; Resource>,
> <sqlalchemy.orm.dependency.MapperStub object at 0x26d3c90>), (<Mapper
> at 0x207a2d0; Resource>, <Mapper at 0x23df210; Stat>), (<Mapper at
> 0x238e890; ContestType>, <Mapper at 0x207a2d0; Resource>), (<Mapper at
> 0x23f30b0; Tournament>, <Mapper at 0x207a2d0; Resource>), (<Mapper at
> 0x238e890; ContestType>, <sqlalchemy.orm.dependency.MapperStub object
> at 0x2497950>), (<Mapper at 0x23b21f0; ContestEventType>,
> <sqlalchemy.orm.dependency.MapperStub object at 0x268ba90>), (<Mapper
> at 0x207a2d0; Resource>, <sqlalchemy.orm.dependency.MapperStub object
> at 0x2664ef0>), (<Mapper at 0x238e9b0; ContestResource>,
> <sqlalchemy.orm.dependency.MapperStub object at 0x266d6f0>), (<Mapper
> at 0x218cc50; StaffPosition>, <sqlalchemy.orm.dependency.MapperStub
> object at 0x26d3c90>), (<Mapper at 0x207a2d0; Resource>,
> <sqlalchemy.orm.dependency.MapperStub object at 0x24bccf0>), (<Mapper
> at 0x238e890; ContestType>, <sqlalchemy.orm.dependency.MapperStub
> object at 0x268ba90>), (<Mapper at 0x238e890; ContestType>, <Mapper at
> 0x23a8eb0; ContestEventTypeGroup>), (<Mapper at 0x207a2d0; Resource>,
> <sqlalchemy.orm.dependency.MapperStub object at 0x2497ff0>), (<Mapper
> at 0x207a2d0; Resource>, <Mapper at 0x23b2770; ContestEvent>)])
> allitems = [<sqlalchemy.orm.dependency.MapperStub object at
> 0x2497950>, <Mapper at 0x23f30b0; Tournament>, <Mapper at 0x238e890;
> ContestType>, <sqlalchemy.orm.dependency.MapperStub object at
> 0x268ba90>, <Mapper at 0x23a8eb0; ContestEventTypeGroup>, <Mapper at
> 0x207a2d0; Resource>]
> (Pdb) u
>> /Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/orm/unitofwork.py(285)_sort_dependencies()
> -> [t.mapper for t in self.tasks.itervalues() if t.base_task is t]
> (Pdb) a
> self = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x2487b30>
> (Pdb) u
>> /Users/percious/clients/mvpss/mvp2.1/lib/python2.6/site-packages/SQLAlchemy-0.6beta3-py2.6.egg/sqlalchemy/orm/unitofwork.py(252)execute()
> -> tasks = self._sort_dependencies()
> (Pdb) a
> self = <sqlalchemy.orm.unitofwork.UOWTransaction object at 0x2487b30>
> 
> Notice I put a probe on and cycle is an empty list in this case.
> Again, this does not happen on every iteration, it's intermittent,
> which leads me to believe its a dictionary/ordering issue.   Also, the
> code runs successfully in beta2.  If you need more debug information
> let me know and I will do what I can to provide that info.
> 
> cheers.
> -chris
> 
> -- 
> 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.
> 

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

Reply via email to