Re: [SQLObject] Temporary Objects (I'm going in!)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Luke O. <lu...@me...> - 2003-04-29 22:56:28
|
> I think t.insertObject(c) isn't a good idea. Client(1) is an > object > that may be in use in several places, and is presumed to be > transparently persistent. When you put it into the transaction > you've > made temporary for all users of the object. Bad bugs will follow. > At > least in threaded situations. > > This is why I think the object has to be instantiated as part of > the > transaction, or perhaps copied if you don't like instantiation... > > t = Transaction() > c = Client(1) > ctmp = c.inTransaction(t) > # or... > ctmp = Client(1, t) > > Ian > I couldn't agree more, this is also refers to the challenges (from an interface perspective) of "insertObject" for new objects. Hence my semantics note, "a temporary object (including one in Transaction: i'm considering transactions to be a simple wrapper around a temporary object implementation) is not visible to anything that doesn't explicitly reference the python-side instance of it". This is also why it seems to me that any Real objects referenced by or to a temp object need to immediately become temp (part of the transaction). My original interface suggestion is very close to what you just wrote, with cInst.temp() or cClass.temp(...) returning temporary objects, outside of being referenced by any other thread unless explicitly passed by the programmer. Anyways, all just wanking until something gets built. :) I'll get on it. - Luke |