From: Marcin Szymanski Date: Thu, 23 Jan 2020 14:50:12 +0000 (+0000) Subject: fix partial ordering X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F646%2Fhead;p=thirdparty%2Fsqlalchemy%2Falembic.git fix partial ordering --- diff --git a/alembic/operations/batch.py b/alembic/operations/batch.py index b5697047..eb10516a 100644 --- a/alembic/operations/batch.py +++ b/alembic/operations/batch.py @@ -212,15 +212,10 @@ class ApplyBatchImpl(object): self.columns = OrderedDict( (k, self.columns[k]) for k in sorted_ ) - #self.dest_column_transfers = self.column_transfers - #print(self.column_transfers) - #print(self.column_transfers) - #sorted_ = topological.sort(pairs, col_by_idx, deterministic_order=True) - #self.dest_column_transfers = OrderedDict( - # (k, self.column_transfers[k]) for k in sorted_ - #) - #print(self.dest_column_transfers) - + sorted_ = topological.sort(pairs, col_by_idx, deterministic_order=True) + self.column_transfers = OrderedDict( + (k, self.column_transfers[k]) for k in sorted_ + ) def _transfer_elements_to_new_table(self): assert self.new_table is None, "Can only create new table once" @@ -230,8 +225,6 @@ class ApplyBatchImpl(object): if self.partial_reordering: self._adjust_self_columns_for_partial_reordering() - # else: - # self.dest_column_transfers = self.column_transfers self.new_table = new_table = Table( self.temp_table_name, diff --git a/tests/test_batch.py b/tests/test_batch.py index 0eab5129..14032e90 100644 --- a/tests/test_batch.py +++ b/tests/test_batch.py @@ -477,10 +477,9 @@ class BatchApplyTest(TestBase): # TODO: doesn't work, don't know why def test_partial_reordering(self): - # MARKMARK impl = self._simple_fixture(partial_reordering=[("x", "id", "y")]) new_table = self._assert_impl(impl, colnames=["x", "id", "y"]) - eq_(new_table.c.g.name, "g") + eq_(new_table.c.x.name, "x") def test_add_server_default(self): impl = self._simple_fixture()