Provide a connection pool implementation, which optionally manages connections on a thread local basis.
Also provides a DBAPI2 transparency layer so that pools can be managed automatically, based on module type and connect arguments, simply by calling regular DBAPI connect() methods.
Return a proxy for module that automatically pools connections.
Given a DBAPI2 module and pool management parameters, returns a proxy for the module that will automatically pool connections, creating new connection pools for each distinct set of connection arguments sent to the decorated module's connect() function.
Arguments:
See the Pool class for options.
A Pool implementation that allows at most one checked out connection at a time.
This will raise an exception if more than one connection is checked out at a time. Useful for debugging code that is using more connections than desired.
A Pool implementation which does not pool connections.
Instead it literally opens and closes the underlying DBAPI connection per each connection open/close.
Base Pool class.
This is an abstract class, which is implemented by various subclasses including:
The main argument, creator, is a callable function that returns a newly connected DBAPI connection object.
Options that are understood by Pool are:
If auto_close_cursors and disallow_open_cursors are both False, then no cursor processing occurs upon checkin.
dispose of this pool.
this method leaves the possibility of checked-out connections remaining opened, so it is advised to not reuse the pool once dispose() is called, and to instead use a new pool constructed by the recreate() method.
when True, enable log output for this element.
This has the effect of setting the Python logging level for the namespace of this element's class and object reference. A value of boolean True indicates that the loglevel logging.INFO will be set for the logger, whereas the string value debug will set the loglevel to logging.DEBUG.
Use Queue.Queue to maintain a fixed-size list of connections.
Arguments include all those used by the base Pool class, as well as:
Maintain one connection per each thread, never moving a connection to a thread other than the one which it was created in.
This is used for SQLite, which both does not handle multithreading by default, and also requires a singleton connection if a :memory: database is being used.
Options are the same as those of Pool, as well as:
dispose of this pool.
this method leaves the possibility of checked-out connections remaining opened, so it is advised to not reuse the pool once dispose() is called, and to instead use a new pool constructed by the recreate() method.
A Pool implementation which stores exactly one connection that is returned for all requests.