On Oct 6, 2010, at 5:46 AM, Warwick Prince wrote:

> Dear All
> 
> I'm having a very strange issue with Sessions that I'm hoping someone can 
> guide me on;
> 
> I have a situation where a large body of code spawns new processes 
> (multiprocessing.process).  The core design manages 3 (possible) database 
> connections, and I've used a unique session for each.  

are you using a unique Engine for each process ?  this part is critical.   
DBAPI connections don't travel across process boundaries very well nor do 
connection pools.  When a new child begins,  you need to call create_engine() 
again for all engines, and use those new binds within that child and only 
there.   You also should be careful that any objects from the parent passed to 
child are immediately merged() into the session local to the child - 
preferably, the child would just re-query its own Session for all the data it 
needs.




-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.

Reply via email to