module documentation

This adapter can convert any DB-API 2.0 driver to an AsyncConnectable asynchronous driver, using Twisted's threading infrastructure and returning Deferreds.

While this adapter does require Twisted be installed, it does not technically require the Twisted mainloop to be running, if you supply your own analog to the callFromThread method on twisted.internet.interfaces.IReactorThreads.

Class ExclusiveWorkQueue No class docstring; 0/1 instance variable, 0/1 class variable, 4/4 methods documented
Class ThreadedCursorAdapter A cursor that can be interacted with asynchronously.
Function adaptSynchronousDriver Adapt a synchronous DB-API 2.0 driver to be an AsyncConnectable a Twisted thread pool.
Type Alias F Undocumented
Class _ThreadedConnectionAdapter Asynchronous database connection that binds to a specific thread.
Function _newThread Undocumented
Function _synthesizeConnector Creates a callable that creates an AsyncConnection via a threadpool.
Type Variable _T Undocumented
def adaptSynchronousDriver(connectCallable: Callable[[], DBAPIConnection], paramstyle: ParamStyle, *, createWorker: Callable[[], IExclusiveWorker] | None = None, callFromThread: Callable[[F], None] | None = None, maxIdleConnections: int = 5) -> AsyncConnectable: (source)

Adapt a synchronous DB-API 2.0 driver to be an AsyncConnectable a Twisted thread pool.

Note
If you do not pass your own callFromThread parameter, this requires the Twisted reactor to be running in order to process responses.

Undocumented

Value
Callable[[], None]
def _newThread() -> IExclusiveWorker: (source)

Undocumented

def _synthesizeConnector(createWorker: Callable[[], IExclusiveWorker], deliver: Callable[[Callable[[], None]], None], connectCallable: Callable[[], DBAPIConnection], paramstyle: ParamStyle) -> Callable[[], Awaitable[AsyncConnection]]: (source)

Creates a callable that creates an AsyncConnection via a threadpool.

Undocumented

Value
TypeVar('_T')