diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-04-14 13:15:21 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-04-14 13:15:21 -0400 |
| commit | cea03be855514d592b6671fa6dbc074a19a795fb (patch) | |
| tree | f127540bda77a4ea5d9935cffedf04d8b01776a9 /lib/sqlalchemy/pool | |
| parent | a898ade3bc36ca27cf9475d1348249646eb40e95 (diff) | |
| download | sqlalchemy-cea03be855514d592b6671fa6dbc074a19a795fb.tar.gz | |
Run search and replace of symbolic module names
Replaces a wide array of Sphinx-relative doc references
with an abbreviated absolute form now supported by
zzzeeksphinx.
Change-Id: I94bffcc3f37885ffdde6238767224296339698a2
Diffstat (limited to 'lib/sqlalchemy/pool')
| -rw-r--r-- | lib/sqlalchemy/pool/base.py | 43 | ||||
| -rw-r--r-- | lib/sqlalchemy/pool/events.py | 29 | ||||
| -rw-r--r-- | lib/sqlalchemy/pool/impl.py | 17 |
3 files changed, 49 insertions, 40 deletions
diff --git a/lib/sqlalchemy/pool/base.py b/lib/sqlalchemy/pool/base.py index 17d5ba15f..7da6e2c4a 100644 --- a/lib/sqlalchemy/pool/base.py +++ b/lib/sqlalchemy/pool/base.py @@ -31,8 +31,8 @@ class _ConnDialect(object): """partial implementation of :class:`.Dialect` which provides DBAPI connection methods. - When a :class:`.Pool` is combined with an :class:`.Engine`, - the :class:`.Engine` replaces this with its own + When a :class:`_pool.Pool` is combined with an :class:`_engine.Engine`, + the :class:`_engine.Engine` replaces this with its own :class:`.Dialect`. """ @@ -94,7 +94,7 @@ class Pool(log.Identified): which defaults to ``sys.stdout`` for output.. If set to the string ``"debug"``, the logging will include pool checkouts and checkins. - The :paramref:`.Pool.echo` parameter can also be set from the + The :paramref:`_pool.Pool.echo` parameter can also be set from the :func:`.create_engine` call by using the :paramref:`.create_engine.echo_pool` parameter. @@ -151,7 +151,7 @@ class Pool(log.Identified): as it is handled by the engine creation strategy. .. versionadded:: 1.1 - ``dialect`` is now a public parameter - to the :class:`.Pool`. + to the :class:`_pool.Pool`. :param pre_ping: if True, the pool will emit a "ping" (typically "SELECT 1", but is dialect-specific) on the connection @@ -264,11 +264,11 @@ class Pool(log.Identified): connection.invalidate(exception) def recreate(self): - """Return a new :class:`.Pool`, of the same class as this one + """Return a new :class:`_pool.Pool`, of the same class as this one and configured with identical creation arguments. This method is used in conjunction with :meth:`dispose` - to close out an entire :class:`.Pool` and create a new one in + to close out an entire :class:`_pool.Pool` and create a new one in its place. """ @@ -301,7 +301,7 @@ class Pool(log.Identified): return _ConnectionFairy._checkout(self) def _return_conn(self, record): - """Given a _ConnectionRecord, return it to the :class:`.Pool`. + """Given a _ConnectionRecord, return it to the :class:`_pool.Pool`. This method is called when an instrumented DBAPI connection has its ``close()`` method called. @@ -326,7 +326,7 @@ class Pool(log.Identified): class _ConnectionRecord(object): """Internal object which maintains an individual DBAPI connection - referenced by a :class:`.Pool`. + referenced by a :class:`_pool.Pool`. The :class:`._ConnectionRecord` object always exists for any particular DBAPI connection whether or not that DBAPI connection has been @@ -340,12 +340,14 @@ class _ConnectionRecord(object): method is called, the DBAPI connection associated with this :class:`._ConnectionRecord` will be discarded, but the :class:`._ConnectionRecord` may be used again, - in which case a new DBAPI connection is produced when the :class:`.Pool` + in which case a new DBAPI connection is produced when the + :class:`_pool.Pool` next uses this record. The :class:`._ConnectionRecord` is delivered along with connection - pool events, including :meth:`.PoolEvents.connect` and - :meth:`.PoolEvents.checkout`, however :class:`._ConnectionRecord` still + pool events, including :meth:`_events.PoolEvents.connect` and + :meth:`_events.PoolEvents.checkout`, however :class:`._ConnectionRecord` + still remains an internal object whose API and internals may change. .. seealso:: @@ -382,7 +384,7 @@ class _ConnectionRecord(object): """The ``.info`` dictionary associated with the DBAPI connection. This dictionary is shared among the :attr:`._ConnectionFairy.info` - and :attr:`.Connection.info` accessors. + and :attr:`_engine.Connection.info` accessors. .. note:: @@ -468,7 +470,8 @@ class _ConnectionRecord(object): This method is called for all connection invalidations, including when the :meth:`._ConnectionFairy.invalidate` or - :meth:`.Connection.invalidate` methods are called, as well as when any + :meth:`_engine.Connection.invalidate` methods are called, + as well as when any so-called "automatic invalidation" condition occurs. :param e: an exception object indicating a reason for the invalidation. @@ -639,9 +642,9 @@ class _ConnectionFairy(object): """Proxies a DBAPI connection and provides return-on-dereference support. - This is an internal object used by the :class:`.Pool` implementation + This is an internal object used by the :class:`_pool.Pool` implementation to provide context management to a DBAPI connection delivered by - that :class:`.Pool`. + that :class:`_pool.Pool`. The name "fairy" is inspired by the fact that the :class:`._ConnectionFairy` object's lifespan is transitory, as it lasts @@ -677,10 +680,11 @@ class _ConnectionFairy(object): rather than directly against the dialect-level do_rollback() and do_commit() methods. - In practice, a :class:`.Connection` assigns a :class:`.Transaction` object + In practice, a :class:`_engine.Connection` assigns a :class:`.Transaction` + object to this variable when one is in scope so that the :class:`.Transaction` takes the job of committing or rolling back on return if - :meth:`.Connection.close` is called while the :class:`.Transaction` + :meth:`_engine.Connection.close` is called while the :class:`.Transaction` still exists. This is essentially an "event handler" of sorts but is simplified as an @@ -838,7 +842,8 @@ class _ConnectionFairy(object): The data here will follow along with the DBAPI connection including after it is returned to the connection pool and used again in subsequent instances of :class:`._ConnectionFairy`. It is shared - with the :attr:`._ConnectionRecord.info` and :attr:`.Connection.info` + with the :attr:`._ConnectionRecord.info` and + :attr:`_engine.Connection.info` accessors. The dictionary associated with a particular DBAPI connection is @@ -869,7 +874,7 @@ class _ConnectionFairy(object): """Mark this connection as invalidated. This method can be called directly, and is also called as a result - of the :meth:`.Connection.invalidate` method. When invoked, + of the :meth:`_engine.Connection.invalidate` method. When invoked, the DBAPI connection is immediately closed and discarded from further use by the pool. The invalidation mechanism proceeds via the :meth:`._ConnectionRecord.invalidate` internal method. diff --git a/lib/sqlalchemy/pool/events.py b/lib/sqlalchemy/pool/events.py index 7a3a0910a..8adfa267c 100644 --- a/lib/sqlalchemy/pool/events.py +++ b/lib/sqlalchemy/pool/events.py @@ -11,7 +11,7 @@ from ..engine.base import Engine class PoolEvents(event.Events): - """Available events for :class:`.Pool`. + """Available events for :class:`_pool.Pool`. The methods here define the name of an event as well as the names of members that are passed to listener @@ -26,11 +26,11 @@ class PoolEvents(event.Events): event.listen(Pool, 'checkout', my_on_checkout) - In addition to accepting the :class:`.Pool` class and - :class:`.Pool` instances, :class:`.PoolEvents` also accepts - :class:`.Engine` objects and the :class:`.Engine` class as + In addition to accepting the :class:`_pool.Pool` class and + :class:`_pool.Pool` instances, :class:`_events.PoolEvents` also accepts + :class:`_engine.Engine` objects and the :class:`_engine.Engine` class as targets, which will be resolved to the ``.pool`` attribute of the - given engine or the :class:`.Pool` class:: + given engine or the :class:`_pool.Pool` class:: engine = create_engine("postgresql://scott:tiger@localhost/test") @@ -56,7 +56,7 @@ class PoolEvents(event.Events): def connect(self, dbapi_connection, connection_record): """Called at the moment a particular DBAPI connection is first - created for a given :class:`.Pool`. + created for a given :class:`_pool.Pool`. This event allows one to capture the point directly after which the DBAPI module-level ``.connect()`` method has been used in order @@ -71,13 +71,16 @@ class PoolEvents(event.Events): def first_connect(self, dbapi_connection, connection_record): """Called exactly once for the first time a DBAPI connection is - checked out from a particular :class:`.Pool`. + checked out from a particular :class:`_pool.Pool`. - The rationale for :meth:`.PoolEvents.first_connect` is to determine + The rationale for :meth:`_events.PoolEvents.first_connect` + is to determine information about a particular series of database connections based on the settings used for all connections. Since a particular - :class:`.Pool` refers to a single "creator" function (which in terms - of a :class:`.Engine` refers to the URL and connection options used), + :class:`_pool.Pool` + refers to a single "creator" function (which in terms + of a :class:`_engine.Engine` + refers to the URL and connection options used), it is typically valid to make observations about a single connection that can be safely assumed to be valid about all subsequent connections, such as the database version, the server and client @@ -108,7 +111,7 @@ class PoolEvents(event.Events): using the new connection. .. seealso:: :meth:`.ConnectionEvents.engine_connect` - a similar event - which occurs upon creation of a new :class:`.Connection`. + which occurs upon creation of a new :class:`_engine.Connection`. """ @@ -136,8 +139,8 @@ class PoolEvents(event.Events): pool argument. - The :meth:`.PoolEvents.reset` event is usually followed by the - :meth:`.PoolEvents.checkin` event is called, except in those + The :meth:`_events.PoolEvents.reset` event is usually followed by the + :meth:`_events.PoolEvents.checkin` event is called, except in those cases where the connection is discarded immediately after reset. :param dbapi_connection: a DBAPI connection. diff --git a/lib/sqlalchemy/pool/impl.py b/lib/sqlalchemy/pool/impl.py index fe87dbb8e..0fe7612b9 100644 --- a/lib/sqlalchemy/pool/impl.py +++ b/lib/sqlalchemy/pool/impl.py @@ -25,10 +25,11 @@ from ..util import threading class QueuePool(Pool): - """A :class:`.Pool` that imposes a limit on the number of open connections. + """A :class:`_pool.Pool` + that imposes a limit on the number of open connections. :class:`.QueuePool` is the default pooling implementation used for - all :class:`.Engine` objects, unless the SQLite dialect is in use. + all :class:`_engine.Engine` objects, unless the SQLite dialect is in use. """ @@ -45,7 +46,7 @@ class QueuePool(Pool): Construct a QueuePool. :param creator: a callable function that returns a DB-API - connection object, same as that of :paramref:`.Pool.creator`. + connection object, same as that of :paramref:`_pool.Pool.creator`. :param pool_size: The size of the pool to be maintained, defaults to 5. This is the largest number of connections that @@ -88,9 +89,9 @@ class QueuePool(Pool): :ref:`pool_disconnects` :param \**kw: Other keyword arguments including - :paramref:`.Pool.recycle`, :paramref:`.Pool.echo`, - :paramref:`.Pool.reset_on_return` and others are passed to the - :class:`.Pool` constructor. + :paramref:`_pool.Pool.recycle`, :paramref:`_pool.Pool.echo`, + :paramref:`_pool.Pool.reset_on_return` and others are passed to the + :class:`_pool.Pool` constructor. """ Pool.__init__(self, creator, **kw) @@ -273,7 +274,7 @@ class SingletonThreadPool(Pool): for production use. - Options are the same as those of :class:`.Pool`, as well as: + Options are the same as those of :class:`_pool.Pool`, as well as: :param pool_size: The number of threads in which to maintain connections at once. Defaults to five. @@ -417,7 +418,7 @@ class StaticPool(Pool): class AssertionPool(Pool): - """A :class:`.Pool` that allows at most one checked out connection at + """A :class:`_pool.Pool` that allows at most one checked out connection at any given time. This will raise an exception if more than one connection is checked out |
