]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add the write_timeout option for mysql.
authorjun923.gu <gujun1989@126.com>
Fri, 30 Nov 2018 05:21:29 +0000 (00:21 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 30 Nov 2018 05:22:58 +0000 (00:22 -0500)
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

doc/build/changelog/unreleased_12/4381.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mysql/mysqldb.py
test/dialect/mysql/test_dialect.py

diff --git a/doc/build/changelog/unreleased_12/4381.rst b/doc/build/changelog/unreleased_12/4381.rst
new file mode 100644 (file)
index 0000000..8e6dff9
--- /dev/null
@@ -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.
index dfa9b52df8fc4c96243ee9417d98ae065914bba4..edac816feb3bae8cc17e4ea62687bf5bdd66fceb 100644 (file)
@@ -162,6 +162,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
index d06b0ddd40240f421a6bee6a028858abe96e10e2..44f786ee037089394abc2dbd3028dbb930335c4b 100644 (file)
@@ -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),