Okay. I believe this is my mistake. I just wrote a simple test program and saw that the other threads should not see o1 or o2 until commit since I am using scoped_session. I guess there is another reason for the behavior I am seeing.
On Aug 28, 10:05 pm, gizli <mehm...@gmail.com> wrote: > Hi all, > > I have a pretty basic question about autoflush that I could not find > an answer to. By default, in sessionmaker, this is set to true. > However, I have this basic scenario where my transaction involves > inserting objects into session and querying for some others: > > add(o1) > query(SomeObject) > add(o2) > commit() > > While this transaction is going on, I dont want any of the other > threads to see o1. Only after commit, both objects should be > visible. > > Does that mean i need to set autoflush to false? Is there any > disadvantage of doing so since this is the default setting? > > Thanks. > > On a related note, the reason why I do not want o1 to appear in the > database without o2 is because they are dependent from the UI point of > view (the rendering page needs an o2 if an o1 is present). Does that > mean they should have been modeled using relations and inserted using > relations as well? That would mean doing the query before o1 and > building o1,o2 together and that would avoid this issue. Is this why I > am running into these problems that seem trivial w.r.t. autoflush? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---