How to Dispose of all Connections in a Pool in a Web Environment?

16 views
Skip to first unread message

mkmo...@gmail.com

unread,
Nov 11, 2022, 12:53:24 PM11/11/22
to sqlalchemy
I'm using the standard connection pool via engine:

    engine = sqlalchemy.create_engine('oracle://scott:tiger@foo', ...)
    conn1 = engine.connect()
    conn2 = engine.connect()

I want to dispose and recreate the pool in a web environment.

All new threads that connect should get a new connection from the pool. All old threads that are using an old connection may continue to do so until they close these connections out.

From what I understand, this is as simple as executing `engine.dispose()`.

Is that correct?

Thanks and best regards,

Matthew

Mike Bayer

unread,
Nov 11, 2022, 1:18:27 PM11/11/22
to noreply-spamdigest via sqlalchemy
engine disposal is discussed in-depth at https://docs.sqlalchemy.org/en/14/core/connections.html#engine-disposal , so if that section is not clarifying then I'd want to know how it can be improved.

your assertion would appear to be correct.
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
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+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages