diff options
author | jun923.gu <gujun1989@126.com> | 2018-11-30 00:21:29 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-11-30 00:32:05 -0500 |
commit | d99e17a7750069880c51a273f08f42fb75c3923d (patch) | |
tree | 5ad31e76fc180bec06c00c6ba0947afc74aa8673 | |
parent | 01e8ac6f5464afb74dbb840d8e5e5153ab43dbc2 (diff) | |
download | sqlalchemy-d99e17a7750069880c51a273f08f42fb75c3923d.tar.gz |
Add the write_timeout option for mysql.
As MySQLdb support read_timeout and write_timeout option, and
sqlalchemy just support read_timeout option. So sqlalchemy need to add
write_timeout option.
Fixes: #4381
Change-Id: I2bea80bdd6f20fafc72b48fa0e5d795626d9d9b9
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4385
(cherry picked from commit 6a8454ded311010927af04db30a57d683cf67dd4)
-rw-r--r-- | doc/build/changelog/unreleased_12/4381.rst | 6 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/mysqldb.py | 1 | ||||
-rw-r--r-- | test/dialect/mysql/test_dialect.py | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/doc/build/changelog/unreleased_12/4381.rst b/doc/build/changelog/unreleased_12/4381.rst new file mode 100644 index 000000000..8e6dff954 --- /dev/null +++ b/doc/build/changelog/unreleased_12/4381.rst @@ -0,0 +1,6 @@ +.. change:: + :tag: feature, mysql + :tickets: 4381 + + Added support for the ``write_timeout`` flag accepted by mysqlclient and + pymysql to be passed in the URL string. diff --git a/lib/sqlalchemy/dialects/mysql/mysqldb.py b/lib/sqlalchemy/dialects/mysql/mysqldb.py index 535c8ec52..d397b5c20 100644 --- a/lib/sqlalchemy/dialects/mysql/mysqldb.py +++ b/lib/sqlalchemy/dialects/mysql/mysqldb.py @@ -138,6 +138,7 @@ class MySQLDialect_mysqldb(MySQLDialect): util.coerce_kw_type(opts, 'compress', bool) util.coerce_kw_type(opts, 'connect_timeout', int) util.coerce_kw_type(opts, 'read_timeout', int) + util.coerce_kw_type(opts, 'write_timeout', int) util.coerce_kw_type(opts, 'client_flag', int) util.coerce_kw_type(opts, 'local_infile', int) # Note: using either of the below will cause all strings to be diff --git a/test/dialect/mysql/test_dialect.py b/test/dialect/mysql/test_dialect.py index d06b0ddd4..44f786ee0 100644 --- a/test/dialect/mysql/test_dialect.py +++ b/test/dialect/mysql/test_dialect.py @@ -54,6 +54,7 @@ class DialectTest(fixtures.TestBase): ('compress', True), ('connect_timeout', 30), ('read_timeout', 30), + ('write_timeout', 30), ('client_flag', 1234), ('local_infile', 1234), ('use_unicode', False), |