From: Mike Bayer Date: Sat, 8 Nov 2008 23:26:55 +0000 (+0000) Subject: usage docstring for pool listener X-Git-Tag: rel_0_5rc4~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6806501f1bb04e48a7f13ab77829f296386462d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git usage docstring for pool listener --- diff --git a/lib/sqlalchemy/interfaces.py b/lib/sqlalchemy/interfaces.py index 959989662d..ae92dc50d0 100644 --- a/lib/sqlalchemy/interfaces.py +++ b/lib/sqlalchemy/interfaces.py @@ -10,6 +10,18 @@ class PoolListener(object): """Hooks into the lifecycle of connections in a ``Pool``. + Usage:: + + # create a new pool with a listener + p = QueuePool(..., listeners=[MyListener()]) + + # add a listener after the fact + p.add_listener(MyListener()) + + # usage with create_engine() + e = create_engine("url://", ...) + e.pool.add_listener(MyListener()) + All of the standard connection [sqlalchemy.pool#Pool] types can accept event listeners for key connection lifecycle events: creation, pool check-out and check-in. There are no events fired @@ -40,6 +52,7 @@ class PoolListener(object): internal event queues based on its capabilities. In terms of efficiency and function call overhead, you're much better off only providing implementations for the hooks you'll be using. + """ def connect(self, dbapi_con, con_record):