class SingletonThreadPool(Pool):
A Pool that maintains one connection per thread.
Maintains one connection per each thread, never moving a connection to a thread other than the one which it was created in.
Warning
the .SingletonThreadPool
will call .close()
on arbitrary connections that exist beyond the size setting of
pool_size, e.g. if more unique thread identities
than what pool_size states are used. This cleanup is
non-deterministic and not sensitive to whether or not the connections
linked to those thread identities are currently in use.
.SingletonThreadPool
may be improved in a future release,
however in its current status it is generally used only for test
scenarios using a SQLite :memory: database and is not recommended
for production use.
Options are the same as those of _pool.Pool
, as well as:
.SingletonThreadPool
is used by the SQLite dialect
automatically when a memory-based database is used.
See :ref:`sqlite_toplevel`.
Parameters | |
pool_size | The number of threads in which to maintain connections at once. Defaults to five. |
Method | __init__ |
Undocumented |
Method | _cleanup |
Undocumented |
Method | _do_get |
Undocumented |
Method | _do_return_conn |
Undocumented |
Method | _return_conn |
Undocumented |
Method | connect |
Undocumented |
Method | dispose |
Dispose of this pool. |
Method | recreate |
Undocumented |
Method | status |
Undocumented |
Class Variable | _is_asyncio |
Undocumented |
Instance Variable | _all_conns |
Undocumented |
Instance Variable | _conn |
Undocumented |
Instance Variable | _fairy |
Undocumented |
Instance Variable | size |
Undocumented |