From: Mike Bayer Date: Fri, 12 Dec 2014 17:55:08 +0000 (-0500) Subject: -Repaired a regression in both the MSSQL and Oracle dialects whereby X-Git-Tag: rel_0_7_2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=206143c9b1f5fe138bb31c33054acee11bcbdb63;p=thirdparty%2Fsqlalchemy%2Falembic.git -Repaired a regression in both the MSSQL and Oracle dialects whereby the overridden ``_exec()`` method failed to return a value, as is needed now in the 0.7 series. fixes #253 - add __backend__ to UpdateRevTest which does a great job testing _exec() pathing for all backends --- diff --git a/alembic/ddl/impl.py b/alembic/ddl/impl.py index b069e47e..cb59cffa 100644 --- a/alembic/ddl/impl.py +++ b/alembic/ddl/impl.py @@ -83,7 +83,6 @@ class DefaultImpl(with_metaclass(ImplMeta)): """ - @property def bind(self): return self.connection diff --git a/alembic/ddl/mssql.py b/alembic/ddl/mssql.py index bcc4ebd3..26c8a256 100644 --- a/alembic/ddl/mssql.py +++ b/alembic/ddl/mssql.py @@ -20,9 +20,10 @@ class MSSQLImpl(DefaultImpl): self.batch_separator) def _exec(self, construct, *args, **kw): - super(MSSQLImpl, self)._exec(construct, *args, **kw) + result = super(MSSQLImpl, self)._exec(construct, *args, **kw) if self.as_sql and self.batch_separator: self.static_output(self.batch_separator) + return result def emit_begin(self): self.static_output("BEGIN TRANSACTION" + self.command_terminator) diff --git a/alembic/ddl/oracle.py b/alembic/ddl/oracle.py index cfe708ca..e528744c 100644 --- a/alembic/ddl/oracle.py +++ b/alembic/ddl/oracle.py @@ -19,9 +19,10 @@ class OracleImpl(DefaultImpl): self.batch_separator) def _exec(self, construct, *args, **kw): - super(OracleImpl, self)._exec(construct, *args, **kw) + result = super(OracleImpl, self)._exec(construct, *args, **kw) if self.as_sql and self.batch_separator: self.static_output(self.batch_separator) + return result def emit_begin(self): self._exec("SET TRANSACTION READ WRITE") diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst index 8fe52167..145cab69 100644 --- a/docs/build/changelog.rst +++ b/docs/build/changelog.rst @@ -16,6 +16,14 @@ Changelog named after the column and look like the FK indexes. Pull request courtesy Johannes Erdfelt. + .. change:: + :tags: bug, mssql, oracle + :tickets: 253 + + Repaired a regression in both the MSSQL and Oracle dialects whereby + the overridden ``_exec()`` method failed to return a value, as is + needed now in the 0.7 series. + .. changelog:: :version: 0.7.1 :released: December 3, 2014 diff --git a/tests/test_version_table.py b/tests/test_version_table.py index 22711807..704bb317 100644 --- a/tests/test_version_table.py +++ b/tests/test_version_table.py @@ -128,6 +128,7 @@ class TestMigrationContext(TestBase): class UpdateRevTest(TestBase): + __backend__ = True @classmethod def setup_class(cls): @@ -146,7 +147,7 @@ class UpdateRevTest(TestBase): self.connection.close() def _assert_heads(self, heads): - eq_(self.context.get_current_heads(), heads) + eq_(set(self.context.get_current_heads()), set(heads)) eq_(self.updater.heads, set(heads)) def test_update_none_to_single(self):