On Tue, Jan 16, 2018 at 5:09 PM, Joe Biggert <jbigg...@gmail.com> wrote:
> Mr. Vanasco,
>
> Can you point me to where I can read more about the cases where `.dispose()`
> is required? You are correct, this is in a web context... and we are using
> mod_wsgi.

use cases for dispose are documented at:

http://docs.sqlalchemy.org/en/latest/core/connections.html?highlight=multiprocessing#engine-disposal

a specific recipe for multiprocessing that works better than dispose() is at:

http://docs.sqlalchemy.org/en/latest/core/pooling.html?highlight=multiprocessing#using-connection-pools-with-multiprocessing

dispose() is not needed inside of a web context.   however, the kind
of web container you're using as well as if you are using something
like gevent or eventlet may be significant in why you are getting idle
transactions.



>
>
> On Tuesday, 16 January 2018 13:59:59 UTC-6, Jonathan Vanasco wrote:
>>
>> On Tuesday, January 16, 2018 at 12:33:42 PM UTC-5, Joe Biggert wrote:
>>>
>>> we've got a wrapper around our requests that basically looks like this:
>>
>>
>> On Tuesday, January 16, 2018 at 2:34:25 PM UTC-5, Mike Bayer wrote:
>>>
>>> the dispose at the end is completely wrong, sorry.
>>
>> ...
>>>
>>> or if you are starting up a new process using either os.fork() or
>>> multiprocessing.
>>
>>
>> Since this appears to be in a web context, I believe `.dispose()` is also
>> required if you're using a forked application server (e.g. uwsgi, mod_wsgi
>> in many contexts, etc).
>>
>> if that is the case and your code is connecting to the database at all
>> before the fork, you should be able to define an "at fork" routine that
>> calls `dispose()` for whatever deployment framework you're using.
>>
>>
>
> --
> 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.

-- 
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