[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-20 Thread Michael Bayer
excellent test case ! heres the bug more directly: from sqlalchemy import * import logging logging.basicConfig() logging.getLogger('sqlalchemy.orm.unitofwork').setLevel(logging.DEBUG) logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) meta = BoundMetaData('sqlite://') a = Table('a'

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-20 Thread svilen
here. There are 2 paths in the dependency-graph, and if it chooses one of them, it goes wrong. The testcase sometimes runs, sometimes not - changing anything (e.g. cmdline params) may change the hash-strategy (hence the choice) - so try many times. one dump is the ok-one, the other is error on

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-19 Thread Michael Bayer
yeah sorry I can conceive of a potential pattern that would raise this issue but im not able to create a mapping/scenario that illustrates it. see if you can get me something on this. On Mar 19, 2007, at 6:49 AM, svilen wrote: > > >> Michael Bayer wrote: >>> So you can take the post_update

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-19 Thread Michael Bayer
but sure give me the logs with sqlalchemy.orm == logging.DEBUG On Mar 19, 2007, at 6:49 AM, svilen wrote: > > >> Michael Bayer wrote: >>> So you can take the post_update out and update to rev 2424. >> > > i have a problem with this 2424, before that was ok. > As i can't separate a short case no

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-19 Thread Michael Bayer
On Mar 19, 2007, at 6:49 AM, svilen wrote: > > for whatever reason it decides that the same object is dirty AND new, > and attempts to reinsert it once more. > Any idea? do u want logs? no idea, except that i can believe its possible since i am adding more rules to the search. need a reprodu

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-19 Thread svilen
> Michael Bayer wrote: > > So you can take the post_update out and update to rev 2424. > i have a problem with this 2424, before that was ok. As i can't separate a short case now, here the conditions: multi-table-inheritance, polymorphic. Nothing else too fancy. table_Entity has primary db_id,

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-19 Thread King Simon-NFHD78
Michael Bayer wrote: > > On Mar 17, 2007, at 11:39 AM, Simon King wrote: > > > > > I had assumed that post_update was only necessary when you are > > inserting two rows that are mutually dependent, but in this case I > > wasn't inserting either a ReleaseLine or a Label. I suppose > > post_upd

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-17 Thread Michael Bayer
On Mar 17, 2007, at 11:39 AM, Simon King wrote: > > I had assumed that post_update was only necessary when you are > inserting two rows that are mutually dependent, but in this case I > wasn't inserting either a ReleaseLine or a Label. I suppose > post_update can actually have a knock-on affect

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-17 Thread Simon King
On Mar 16, 9:50 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > 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 cr

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-16 Thread Michael Bayer
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=

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-16 Thread King Simon-NFHD78
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

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-16 Thread Michael Bayer
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 pa

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-16 Thread Michael Bayer
On Mar 16, 2007, at 6:59 AM, King Simon-NFHD78 wrote: > 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? > these issues are often d

[sqlalchemy] Re: Inconsistent results in session.flush()

2007-03-16 Thread svilen
one thing u can do is to replace some/all {} dicts with util.OrderedDict (and util.Set with util.OrderdSet) - including your owns!. u would be able to compare things easier then. or, try going backward to some rev that works, and check changes inbetween. > Hi, > > I'm having a problem where t