oh, this is easy. you have a circular insert relationship between "label" and "release_line", which you can see in the sort there (the "cycles:") as well as evidenced by the fact that you have a "use_alter" needed in order to create the foreign keys on those two tables. add "post_update=True" to one of the relationships which will break that particular cycle by using a second UPDATE statement, and youre in.
On Mar 16, 2007, at 1:58 PM, King Simon-NFHD78 wrote: > I've just run the attached script about thirty times, and it > succeeded 5 > times and failed the rest. I've cut out a lot of unnecessary stuff, > but > it's still a bit long I'm afraid. I'll cut it down some more, but > since > you seemed so eager to see it ;-) I thought I'd send it along as is. > > On a bad run, the dependency tuples look like this: > > DEBUG:sqlalchemy.orm.unitofwork.UOWTransaction.0x..50:Dependency sort: > Mapper|User|user > Mapper|Component|component > Mapper|ChangeOrigin|change_origin > Mapper|Label|label (cycles: [Mapper|Label|label, > Mapper|ReleaseLine|release_line]) > Mapper|Counter|counter > Mapper|Branch|branch > <sqlalchemy.orm.dependency.MapperStub object at 0x00D59590> > > And on a good run they look like this: > > DEBUG:sqlalchemy.orm.unitofwork.UOWTransaction.0x..10:Dependency sort: > Mapper|User|user > Mapper|Component|component > Mapper|ChangeOrigin|change_origin > Mapper|ReleaseLine|release_line (cycles: > [Mapper|ReleaseLine|release_line, Mapper|Label|label]) > Mapper|Counter|counter > Mapper|Branch|branch > <sqlalchemy.orm.dependency.MapperStub object at 0x00D59670> > > Thanks a lot for looking at this, > > Simon > > Michael Bayer wrote: >> >> I can actually read a fair degree from these dumps, i need >> mostly to know what the actual dependencies are (i.e. which >> classes are dependent on what, whats the error). also when >> you do the full debug echoing the UOW should illustrate a >> series of "dependency tuples" >> which will show what pairs of classes the UOW perceives as >> "dependent" on each other. >> >> On Mar 16, 2007, at 6:59 AM, King Simon-NFHD78 wrote: >> >>> >>> Hi, >>> >>> I'm having a problem where the results of session.flush() vary from >>> one run to another of my test suite. The unit of work >> transaction dump >>> is significantly different from one run to the next, similar to the >>> issue in ticket 461. I haven't managed to make a test case small >>> enough to post to the list yet, and I think I need to delve >> a little >>> further into the code to find out why it's failing. >>> >>> (This is with both 0.3.5 and rev2416) >>> >>> The logs from the UOWTransaction on a failing run and a passing run >>> are below. As well as the ordering being different, there >> is at least >>> one class (ReleaseLine) that doesn't appear in the bad run. >>> >>> Unfortunately I don't know how to go about debugging this. >> I think I >>> need to see exactly what is going on in the dependency sort. Do you >>> have any suggestions for suitable places to add some extra logging? >>> >>> This is a failing run: >>> INFO:sqlalchemy.orm.unitofwork.UOWTransaction.0x..30:Task dump: >>> >>> UOWTask(0x184b2b0, Component/component/None) (save/update phase) >>> | >>> |- UOWTask(0x184bb50, User/user/None) (save/update phase) >>> | |- Save User(0x1851870) >>> | | |- Process User(0x1851870).branches >>> | | |- Process User(0x1851870).reviews >>> | | |- Process User(0x1851870).labels >>> | | |- Process Branch(0x17ee310).user >>> | | |- Process Branch(0x184b190).user >>> | | >>> | |- UOWTask(0x184bb70, ChangeOrigin/change_origin/None) >>> (save/update phase) >>> | | | |- Process Branch(0x17ee310).change_origin >>> | | | |- Process Branch(0x184b190).change_origin >>> | | | >>> | | |- UOWTask(0x184b590, Label/label/None) >> (save/update phase) >>> | | | | >>> | | | |- UOWTask(0x184b1b0, Branch/branch/None) >> (save/update >>> phase) >>> | | | | |- Save Branch(0x17ee310) >>> | | | | |- Save Branch(0x184b190) >>> | | | | | |- Process Branch(0x17ee310).review >>> | | | | | |- Process Branch(0x184b190).review >>> | | | | | >>> | | | | |- UOWTask(0x183f470, Review/review/None) >>> (save/update phase) >>> >>> | | | | | |---- >>> | | | | | >>> | | | | | >>> | | | | |- UOWTask(0x184bb30, >>> <sqlalchemy.orm.dependency.MapperStub object at 0x0183FDF0>) >>> (save/update phase) >>> | | | | | | |- Process Branch(0x17ee310).label >>> | | | | | | |- Process Branch(0x184b190).label >>> | | | | | |---- >>> | | | | | >>> | | | | |---- >>> | | | | >>> | | | | >>> | | | |- UOWTask(0x184bfb0, Counter/counter/None) (save/ >>> update >>> phase) >>> | | | | |- Save Counter(0x184b0f0) >>> | | | | |---- >>> | | | | >>> | | | |---- >>> | | | >>> | | |---- >>> | | >>> | |---- >>> | >>> | >>> |- UOWTask(0x184bb50, User/user/None) (delete phase) >>> | | >>> | |- UOWTask(0x184bb70, >> ChangeOrigin/change_origin/None) (delete >>> phase) >>> | | | >>> | | |- UOWTask(0x184b590, Label/label/None) (delete phase) >>> | | | | >>> | | | |- UOWTask(0x184b1b0, Branch/branch/None) (delete >>> phase) >>> | | | | | >>> | | | | |- UOWTask(0x183f470, Review/review/None) (delete >>> phase) >>> | | | | | |---- >>> | | | | | >>> | | | | | >>> | | | | |- UOWTask(0x184bb30, >>> <sqlalchemy.orm.dependency.MapperStub object at 0x0183FDF0>) (delete >>> phase) >>> | | | | | |---- >>> | | | | | >>> | | | | |---- >>> | | | | >>> | | | | >>> | | | |- UOWTask(0x184bfb0, Counter/counter/None) (delete >>> phase) >>> | | | | |---- >>> | | | | >>> | | | |---- >>> | | | >>> | | |---- >>> | | >>> | |---- >>> | >>> |---- >>> >>> And on a good run looks like this: >>> >>> INFO:sqlalchemy.orm.unitofwork.UOWTransaction.0x..f0:Task dump: >>> >>> UOWTask(0x17f2610, User/user/None) (save/update phase) >>> |- Save User(0x17fe9f0) >>> | |- Process User(0x17fe9f0).labels >>> | |- Process Branch(0x17caa10).user >>> | |- Process Branch(0x17f2470).user >>> | |- Process User(0x17fe9f0).reviews >>> | |- Process User(0x17fe9f0).branches >>> | >>> |- UOWTask(0x17f2a50, ChangeOrigin/change_origin/None) >> (save/update >>> phase) >>> | | |- Process Branch(0x17caa10).change_origin >>> | | |- Process Branch(0x17f2470).change_origin >>> | | >>> | |- UOWTask(0x17f29f0, Component/component/None) (save/update >>> phase) >>> | | | >>> | | |- UOWTask(0x17f2ad0, ReleaseLine/release_line/None) >>> (save/update phase) >>> | | | | |- Process Branch(0x17caa10).release_line >>> | | | | |- Process Branch(0x17f2470).release_line >>> | | | | |- Process Counter(0x17fed10).release_line >>> | | | | >>> | | | |- UOWTask(0x17f2430, Counter/counter/None) (save/ >>> update >>> phase) >>> | | | | |- Save Counter(0x17fed10) >>> | | | | |---- >>> | | | | >>> | | | | >>> | | | |- UOWTask(0x17f2450, Branch/branch/None) >> (save/update >>> phase) >>> | | | | |- Save Branch(0x17caa10) >>> | | | | |- Save Branch(0x17f2470) >>> | | | | | |- Process Branch(0x17caa10).review >>> | | | | | |- Process Branch(0x17f2470).review >>> | | | | | >>> | | | | |- UOWTask(0x17faf70, Review/review/None) >>> (save/update phase) >>> >>> | | | | | |---- >>> | | | | | >>> | | | | | >>> | | | | |- UOWTask(0x17f2810, >>> <sqlalchemy.orm.dependency.MapperStub object at 0x017DF590>) >>> (save/update phase) >>> | | | | | | |- Process Branch(0x17caa10).label >>> | | | | | | |- Process Branch(0x17f2470).label >>> | | | | | |---- >>> | | | | | >>> | | | | |---- >>> | | | | >>> | | | |---- >>> | | | >>> | | |---- >>> | | >>> | |---- >>> | >>> | >>> |- UOWTask(0x17f2a50, ChangeOrigin/change_origin/None) (delete >>> phase) >>> | | >>> | |- UOWTask(0x17f29f0, Component/component/None) >> (delete phase) >>> | | | >>> | | |- UOWTask(0x17f2ad0, ReleaseLine/release_line/None) >>> (delete >>> phase) >>> | | | | >>> | | | |- UOWTask(0x17f2430, Counter/counter/None) (delete >>> phase) >>> | | | | |---- >>> | | | | >>> | | | | >>> | | | |- UOWTask(0x17f2450, Branch/branch/None) (delete >>> phase) >>> | | | | | >>> | | | | |- UOWTask(0x17faf70, Review/review/None) (delete >>> phase) >>> | | | | | |---- >>> | | | | | >>> | | | | | >>> | | | | |- UOWTask(0x17f2810, >>> <sqlalchemy.orm.dependency.MapperStub object at 0x017DF590>) (delete >>> phase) >>> | | | | | |---- >>> | | | | | >>> | | | | |---- >>> | | | | >>> | | | |---- >>> | | | >>> | | |---- >>> | | >>> | |---- >>> | >>> |---- >>> >>>> >> >> >>> >> > > > > <single_test.py> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---