Thread: [SQLObject] Using __connection__ in a multi-thread application
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Alex <xk...@gm...> - 2009-06-24 09:50:47
|
Is it thread safe to define __connections__ on the startup of a server for the later use in multiple threads? ... __connection__ = connectionForURI(connection_string) class Person(SQLObject): ... class MultithreadAppUsingPerson: ... persons = Person.select() ... aMultithreadAppUsingPerson.run() If it's not ok, how can I predefine connection for each thread without the necessity to pass the connection explicitly on every instantiation? I would really like to workaround the straightforward code-consuming approach. |
From: Oleg B. <ph...@ph...> - 2009-06-24 14:29:07
|
On Wed, Jun 24, 2009 at 01:50:29PM +0400, Alex wrote: > how can I predefine connection for each thread without > the necessity to pass the connection explicitly on every > instantiation? from sqlobject import sqlhub sqlhub.threadConnection = connectionForURI(connection_string) Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |