| nah, its working by design, but you might not like it. try these lines instead: del objectstore.uow().identity_map[Transition.mapper.instance_key(t1)] del objectstore.uow().identity_map[Place.mapper.instance_key(p2)] p2 = Place.mapper.get(p2.place_id) t1 = Transition.mapper.get(t1.transition_id) self.assert_result([t1], Transition, {'outputs': (Place, [{'name':'place3'}, {'name':'place1'}])}) p2 = Place.eagermapper.get(p2.place_id) self.assert_result([p2], Place, {'inputs': (Transition, [{'name':'transition2'},{'name':'transition1'}])}) so heres the changes: 1. assert_result takes a list as the first argument since its normally used with the results of a select() 2. p2 is attached to transition1/transition2 as an "input" not an output in this test 3. the nature of the relationship here is such that transition1 gets associated with place2 by attaching a place2 to transition1. however, that also means that transition1 is attached to place2. But, since place2 was created in this same "transaction", all its attributes are already assumed to be loaded, and its not going to go and change around what youve set. So, we force it to reload place2 altogether by removing it from the objectstore and reloading (and also transition1). If you dont clear the objects out, the state that they received from the test suite before committing is incomplete, and the mapper doesnt try to guess which state needs to be filled in and which doesn't after a commit. So #3 is really where this thing is going to get tricky for people. Im probably going to have to add a lot more methods and configurations to the whole "objectstore" thing to give users greater control over what objects are loaded, what objects are not, easy ways to mark an object as "to be reloaded", etc. This is why the docs for unitofwork are blank :). its the simplest yet the hardest. if you look at the docs and user comments for hibernate, youll see the same thing...a lot of complexity with regards to "object scope". I am hoping this thing remains fairly simple compared to that. On Dec 4, 2005, at 12:39 PM, Shuo Yang wrote: Yea, there actually may be some funkiness in the many-to-many. |
- Re: [Sqlalchemy-users] Many to many problem? Michael Bayer
- Re: [Sqlalchemy-users] Many to many problem? Robert Leftwich
- Re: [Sqlalchemy-users] Many to many problem? Michael Bayer
- Re: [Sqlalchemy-users] Many to many problem? Shuo Yang
- Re: [Sqlalchemy-users] Many to many probl... Michael Bayer
- Re: [Sqlalchemy-users] Many to many ... Shuo Yang
- Re: [Sqlalchemy-users] Many to m... Michael Bayer
- Re: [Sqlalchemy-users] Many ... Michael Bayer
- Re: [Sqlalchemy-users] Many ... Shuo Yang
- Re: [Sqlalchemy-users] Many ... Robert Leftwich
- Re: [Sqlalchemy-users] Many ... Michael Bayer

