On Mon, Apr 2, 2018 at 10:19 PM, Jonathan Vanasco <[email protected]> wrote:
> looking at the current `engine.dispose()` (which I should have done sooner),
> that's pretty much what it's doing -- right?
>
> https://bitbucket.org/zzzeek/sqlalchemy/src/55371f4cffa730f65f1b687e9f6287d2ac189227/lib/sqlalchemy/engine/base.py?at=master&fileviewer=file-view-default#base.py-1899:1923
>
>
>         self.pool.dispose()
>         self.pool = self.pool.recreate()
>         self.dispatch.engine_disposed(self)
>
>
> or are you thinking of something that would not call the dispose(), this way
> the main process can keep that connection?


right, the dispose() will emit "close connection" commands on the
socket which will leak into the parent process.


>
> something like...
>
>     original_pool = dbSession.connection().engine.detach()
>
>
>    def detach(self):
>        """replaces the pool"""
>
>        old_pool = self.pool
>
>        self.pool = self.pool.recreate()
>
>        return old_pool
>
>
> Are the checked-out connections stored anywhere?  The
> 'Pool._all_connections' attribute seems to be more like '_idle_connections'
> or '_available_connections'

they're not ! :)   that's one of the "features" of QueuePool.  only
when they get checked in again does the QP have any idea who they are.

I wrote an alternative pool some months ago that works identically to
QueuePool but does the more traditional approach of having a fixed
"slot" for every possible connection.    That would be a nice pool to
use someday, but unfortunately doesn't have the ten years of
production use by thousands of applications behind it.




>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to