Re: [SQLObject] Thread Safety and SQLObject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Luke O. <lu...@me...> - 2003-05-22 22:03:52
|
> 1. Why isn't connection = conn making this Do The Right Thing? I
> thought the semantics I've shown above would be creating a new DB
> connection every time, and thus hopefully have the child avoid
> interfering with the parent.
I'm going to make a wild guess, and noting that CVS is still missing certain
fixes that were pointed out when I last posted MemoryTransaction...:
around line 683, in new(), add the following line:
if kw.has_key('connection'):
inst = cls(None, connection=kw['connection'])
+ inst._connection = kw['connection']
del kw['connection']
There are related bugs in RelatedJoin.add and RelatedJoin.remove, where they
should use the connection from inst and not self.callingClass.
> 2. Is there any way to use SQLObject safely in a threaded environment
> like the os.fork'ing example I have above?
So long as you don't have any of the potential concurrency problems of trying
to update the same object from separate threads etc, I think the connection
problem above will solve it. And even in those cases, SQLObject shouldn't blow
up, you just don't know what data you'll end up with. :)
- Luke
|