From 6a8454ded311010927af04db30a57d683cf67dd4 Mon Sep 17 00:00:00 2001 From: "jun923.gu" Date: Fri, 30 Nov 2018 00:21:29 -0500 Subject: [PATCH] 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 --- doc/build/changelog/unreleased_12/4381.rst | 6 ++++++ lib/sqlalchemy/dialects/mysql/mysqldb.py | 1 + test/dialect/mysql/test_dialect.py | 1 + 3 files changed, 8 insertions(+) create mode 100644 doc/build/changelog/unreleased_12/4381.rst diff --git a/doc/build/changelog/unreleased_12/4381.rst b/doc/build/changelog/unreleased_12/4381.rst new file mode 100644 index 0000000000..8e6dff9549 --- /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 dfa9b52df8..edac816feb 100644 --- a/lib/sqlalchemy/dialects/mysql/mysqldb.py +++ b/lib/sqlalchemy/dialects/mysql/mysqldb.py @@ -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 diff --git a/test/dialect/mysql/test_dialect.py b/test/dialect/mysql/test_dialect.py index d06b0ddd40..44f786ee03 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), -- 2.47.2