On Wednesday, January 17, 2018 at 9:40:23 AM UTC-5, Mike Bayer wrote:
 

>
> if you create your engine in your parent process, and then let that 
> engine travel into a fork(), then yes, you need to call dispose() just 
> once when the fork starts, so that you get new connections in your 
> forked process.  I mentioned that above. 


that's what we do!  sorry, I read things wrong and thought you said we 
shouldn't do that.
 

> however, there's a neater way that we do this in openstack which I also 
> refer to above in the 

pooling docs, that is to use an event to track which process a 
> particular connection was created within, and invalidate it if the two 
> don't match.    yet another thing that could be just added to the pool 
> :)   create_engine(..., protect_across_forks=True) 


that's much neater, and I'll add that as a backup!   i still need to use 
fork events because some other libraries depend on it (the crypto library i 
use on a few deployments isn't forksafe, and there's another library on a 
legacy project that I can't remember)
 

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to