diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-07-09 16:04:07 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-07-09 16:04:07 -0400 |
commit | 2b85e80d75f58a7691533a44693378e28ead752c (patch) | |
tree | a30099e5221ab4f602705589ac205212617db9a0 | |
parent | 04e9a81136902862edfd23d63bfab8dfb0953cc3 (diff) | |
download | sqlalchemy-2b85e80d75f58a7691533a44693378e28ead752c.tar.gz |
- Changed the default value of "raise_on_warnings" to False for
MySQLconnector. This was set at True for some reason. The "buffered"
flag unfortunately must stay at True as MySQLconnector does not allow
a cursor to be closed unless all results are fully fetched. fixes #2515
- lots of MySQL tests seemed to not be hitting all backends, so we should
be getting some mysqlconnector failures now
-rw-r--r-- | doc/build/changelog/changelog_10.rst | 9 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/mysql/mysqlconnector.py | 4 | ||||
-rw-r--r-- | test/dialect/mysql/test_dialect.py | 6 | ||||
-rw-r--r-- | test/dialect/mysql/test_query.py | 1 | ||||
-rw-r--r-- | test/dialect/mysql/test_reflection.py | 1 | ||||
-rw-r--r-- | test/dialect/mysql/test_types.py | 4 |
6 files changed, 21 insertions, 4 deletions
diff --git a/doc/build/changelog/changelog_10.rst b/doc/build/changelog/changelog_10.rst index de351326e..57ca3c863 100644 --- a/doc/build/changelog/changelog_10.rst +++ b/doc/build/changelog/changelog_10.rst @@ -17,6 +17,15 @@ :version: 1.0.0 .. change:: + :tags: mysql, bug + :tickets: 2515 + + Changed the default value of "raise_on_warnings" to False for + MySQLconnector. This was set at True for some reason. The "buffered" + flag unfortunately must stay at True as MySQLconnector does not allow + a cursor to be closed unless all results are fully fetched. + + .. change:: :tags: bug, orm :tickets: 3117 diff --git a/lib/sqlalchemy/dialects/mysql/mysqlconnector.py b/lib/sqlalchemy/dialects/mysql/mysqlconnector.py index 3536c3ad8..83e731c16 100644 --- a/lib/sqlalchemy/dialects/mysql/mysqlconnector.py +++ b/lib/sqlalchemy/dialects/mysql/mysqlconnector.py @@ -87,8 +87,10 @@ class MySQLDialect_mysqlconnector(MySQLDialect): util.coerce_kw_type(opts, 'buffered', bool) util.coerce_kw_type(opts, 'raise_on_warnings', bool) + + # unfortunately, MySQL/connector python refuses to release a + # cursor without reading fully, so non-buffered isn't an option opts.setdefault('buffered', True) - opts.setdefault('raise_on_warnings', True) # FOUND_ROWS must be set in ClientFlag to enable # supports_sane_rowcount. diff --git a/test/dialect/mysql/test_dialect.py b/test/dialect/mysql/test_dialect.py index 2ff17f0f7..e6bad71a4 100644 --- a/test/dialect/mysql/test_dialect.py +++ b/test/dialect/mysql/test_dialect.py @@ -69,10 +69,11 @@ class DialectTest(fixtures.TestBase): )[1] eq_(kw['raise_on_warnings'], False) + kw = dialect.create_connect_args( make_url("mysql+mysqlconnector://u:p@host/db") )[1] - eq_(kw['raise_on_warnings'], True) + assert "raise_on_warnings" not in kw @testing.only_on('mysql') def test_random_arg(self): @@ -84,11 +85,11 @@ class DialectTest(fixtures.TestBase): class SQLModeDetectionTest(fixtures.TestBase): __only_on__ = 'mysql' + __backend__ = True def _options(self, modes): def connect(con, record): cursor = con.cursor() - print("DOING THiS:", "set sql_mode='%s'" % (",".join(modes))) cursor.execute("set sql_mode='%s'" % (",".join(modes))) e = engines.testing_engine(options={ 'pool_events':[ @@ -131,6 +132,7 @@ class ExecutionTest(fixtures.TestBase): """Various MySQL execution special cases.""" __only_on__ = 'mysql' + __backend__ = True def test_charset_caching(self): engine = engines.testing_engine() diff --git a/test/dialect/mysql/test_query.py b/test/dialect/mysql/test_query.py index 040004808..dd11fe2b4 100644 --- a/test/dialect/mysql/test_query.py +++ b/test/dialect/mysql/test_query.py @@ -8,6 +8,7 @@ from sqlalchemy import testing class MatchTest(fixtures.TestBase, AssertsCompiledSQL): __only_on__ = 'mysql' + __backend__ = True @classmethod def setup_class(cls): diff --git a/test/dialect/mysql/test_reflection.py b/test/dialect/mysql/test_reflection.py index c8fdc9310..bf35a2c6b 100644 --- a/test/dialect/mysql/test_reflection.py +++ b/test/dialect/mysql/test_reflection.py @@ -10,6 +10,7 @@ from sqlalchemy import testing class ReflectionTest(fixtures.TestBase, AssertsExecutionResults): __only_on__ = 'mysql' + __backend__ = True def test_default_reflection(self): """Test reflection of column defaults.""" diff --git a/test/dialect/mysql/test_types.py b/test/dialect/mysql/test_types.py index b7d261a88..f5901812e 100644 --- a/test/dialect/mysql/test_types.py +++ b/test/dialect/mysql/test_types.py @@ -15,6 +15,7 @@ class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): "Test MySQL column types" __dialect__ = mysql.dialect() + __backend__ = True def test_numeric(self): "Exercise type specification and options for numeric types." @@ -257,7 +258,7 @@ class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): res ) - @testing.only_if('mysql') + @testing.only_if('mysql+mysqldb') @testing.exclude('mysql', '<', (5, 0, 5), 'a 5.0+ feature') @testing.provide_metadata def test_charset_collate_table(self): @@ -554,6 +555,7 @@ class EnumSetTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL __only_on__ = 'mysql' __dialect__ = mysql.dialect() + __backend__ = True @testing.provide_metadata |