diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-30 17:12:58 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-30 17:12:58 -0400 |
| commit | 081d4275cf5c3e6842c8e0198542ff89617eaa96 (patch) | |
| tree | 482a9c031a6a6259bd5e8254feec6779caa1b8f7 | |
| parent | d8bb208a85f6366c58426a85b3d4ec1d6e43ac6c (diff) | |
| download | sqlalchemy-081d4275cf5c3e6842c8e0198542ff89617eaa96.tar.gz | |
MariaDB 10.3 updates
MariaDB seems to handle some additional UPDATE/DELETE FROM
syntaxes as well as some forms of INTERSECT and EXCEPT. Open
up tests that expect failure for MySQL to allow success for
MariaDB 10.3.
Change-Id: Ia9341a82485ef7201bb8130d8dbf4a9b6976035a
| -rw-r--r-- | lib/sqlalchemy/testing/requirements.py | 4 | ||||
| -rw-r--r-- | test/orm/test_update_delete.py | 2 | ||||
| -rw-r--r-- | test/requirements.py | 27 | ||||
| -rw-r--r-- | test/sql/test_query.py | 6 |
4 files changed, 25 insertions, 14 deletions
diff --git a/lib/sqlalchemy/testing/requirements.py b/lib/sqlalchemy/testing/requirements.py index 2a5262e4e..58df643f4 100644 --- a/lib/sqlalchemy/testing/requirements.py +++ b/lib/sqlalchemy/testing/requirements.py @@ -751,8 +751,8 @@ class SuiteRequirements(Requirements): @property def update_where_target_in_subquery(self): - """Target must support UPDATE where the same table is present in a - subquery in the WHERE clause. + """Target must support UPDATE (or DELETE) where the same table is + present in a subquery in the WHERE clause. This is an ANSI-standard syntax that apparently MySQL can't handle, such as: diff --git a/test/orm/test_update_delete.py b/test/orm/test_update_delete.py index 98fcc4f00..d1ccbb2e1 100644 --- a/test/orm/test_update_delete.py +++ b/test/orm/test_update_delete.py @@ -275,7 +275,7 @@ class UpdateDeleteTest(fixtures.MappedTest): eq_(sess.query(User).order_by(User.id).all(), [jack, jane]) - @testing.fails_on('mysql', 'FIXME: unknown') + @testing.requires.update_where_target_in_subquery def test_delete_invalid_evaluation(self): User = self.classes.User diff --git a/test/requirements.py b/test/requirements.py index db6466f22..1cf40d8a4 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -360,8 +360,8 @@ class DefaultRequirements(SuiteRequirements): @property def update_where_target_in_subquery(self): - """Target must support UPDATE where the same table is present in a - subquery in the WHERE clause. + """Target must support UPDATE (or DELETE) where the same table is + present in a subquery in the WHERE clause. This is an ANSI-standard syntax that apparently MySQL can't handle, such as: @@ -371,9 +371,10 @@ class DefaultRequirements(SuiteRequirements): FROM documents GROUP BY documents.user_id ) """ - return fails_if('mysql', - 'MySQL error 1093 "Cant specify target table ' - 'for update in FROM clause"') + return fails_if( + self._mysql_not_mariadb_103, + 'MySQL error 1093 "Cant specify target table ' + 'for update in FROM clause", resolved by MariaDB 10.3') @property def savepoints(self): @@ -521,15 +522,17 @@ class DefaultRequirements(SuiteRequirements): """Target database must support INTERSECT or equivalent.""" return fails_if([ - "firebird", "mysql", "sybase", - ], 'no support for INTERSECT') + "firebird", self._mysql_not_mariadb_103, + "sybase", + ], 'no support for INTERSECT') @property def except_(self): """Target database must support EXCEPT or equivalent (i.e. MINUS).""" return fails_if([ - "firebird", "mysql", "sybase", - ], 'no support for EXCEPT') + "firebird", self._mysql_not_mariadb_103, + "sybase", + ], 'no support for EXCEPT') @property def order_by_col_from_union(self): @@ -1185,6 +1188,12 @@ class DefaultRequirements(SuiteRequirements): config.db.dialect._mariadb_normalized_version_info < (10, 2) ) + def _mysql_not_mariadb_103(self, config): + return against(config, "mysql") and ( + not config.db.dialect._is_mariadb or + config.db.dialect._mariadb_normalized_version_info < (10, 3) + ) + def _has_mysql_on_windows(self, config): return against(config, 'mysql') and \ config.db.dialect._detect_casing(config.db) == 1 diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 1d562c2db..971374eb9 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -1008,7 +1008,8 @@ class CompoundTest(fixtures.TestBase): found2 = self._fetchall_sorted(e.alias().select().execute()) eq_(found2, wanted) - @testing.fails_on('sqlite', "Can't handle this style of nesting") + @testing.fails_on( + ['sqlite', 'mysql'], "Can't handle this style of nesting") @testing.requires.except_ def test_except_style3(self): # aaa, bbb, ccc - (aaa, bbb, ccc - (ccc)) = ccc @@ -1040,7 +1041,8 @@ class CompoundTest(fixtures.TestBase): ) @testing.requires.intersect - @testing.fails_on('sqlite', "sqlite can't handle leading parenthesis") + @testing.fails_on(['sqlite', 'mysql'], + "sqlite can't handle leading parenthesis") def test_intersect_unions(self): u = intersect( union( |
