diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-08-22 16:50:19 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-08-22 16:52:10 -0400 |
commit | 2db525614371de011b2c65a41a8b342b15865f3c (patch) | |
tree | c69591b40b453a8706eb040e7634327c16bad387 /lib/sqlalchemy/dialects/mysql/base.py | |
parent | 8b53548b9e972f243adaf5b4599b0ddd9e43927b (diff) | |
download | sqlalchemy-2db525614371de011b2c65a41a8b342b15865f3c.tar.gz |
- modernize the mysql connection timeout docs
Change-Id: Icb0474509539c1eb7536544749f2a48b4972078a
(cherry picked from commit 4ce46fb0a085c1cc739e21881cc25567e663f8dc)
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 1781f9bb7..d6701aeae 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -23,19 +23,26 @@ supported in any given server release. .. _mysql_connection_timeouts: -Connection Timeouts -------------------- +Connection Timeouts and Disconnects +----------------------------------- MySQL features an automatic connection close behavior, for connections that -have been idle for eight hours or more. To circumvent having this issue, use -the ``pool_recycle`` option which controls the maximum age of any connection:: +have been idle for a fixed period of time, defaulting to eight hours. +To circumvent having this issue, use +the :paramref:`.create_engine.pool_recycle` option which ensures that +a connection will be discarded and replaced with a new one if it has been +present in the pool for a fixed number of seconds:: engine = create_engine('mysql+mysqldb://...', pool_recycle=3600) -.. seealso:: +For more comprehensive disconnect detection of pooled connections, including +accommodation of server restarts and network issues, a pre-ping approach may +be employed. See :ref:`pool_disconnects` for current approaches. - :ref:`pool_setting_recycle` - full description of the pool recycle feature. +.. seealso:: + :ref:`pool_disconnects` - Background on several techniques for dealing + with timed out connections as well as database restarts. .. _mysql_storage_engines: |