summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-01-26 16:41:26 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2016-01-26 16:41:26 -0500
commit8163de4cc9e01460d3476b9fb3ed14a5b3e70bae (patch)
treefad1174f23337dabe614ea54255558a61ae2a8bf /test/sql
parent9d9fc93b7065d25a088e244961cf54606ad80b31 (diff)
downloadsqlalchemy-8163de4cc9e01460d3476b9fb3ed14a5b3e70bae.tar.gz
- rework ColumnCollection to no longer persist "all_col_set"; we don't
need this collection except in the extend/update uses where we create it ad-hoc. simplifies pickling. Compatibility with 1.0 should be OK as ColumnColleciton uses __getstate__ in any case and the __setstate__ contract hasn't changed. - Fixed bug in :class:`.Table` metadata construct which appeared around the 0.9 series where adding columns to a :class:`.Table` that was unpickled would fail to correctly establish the :class:`.Column` within the 'c' collection, leading to issues in areas such as ORM configuration. This could impact use cases such as ``extend_existing`` and others. fixes #3632
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_metadata.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py
index 47ecf5a9b..050929d3d 100644
--- a/test/sql/test_metadata.py
+++ b/test/sql/test_metadata.py
@@ -1258,6 +1258,25 @@ class TableTest(fixtures.TestBase, AssertsCompiledSQL):
assign2
)
+ def test_c_mutate_after_unpickle(self):
+ m = MetaData()
+
+ y = Column('y', Integer)
+ t1 = Table('t', m, Column('x', Integer), y)
+
+ t2 = pickle.loads(pickle.dumps(t1))
+ z = Column('z', Integer)
+ g = Column('g', Integer)
+ t2.append_column(z)
+
+ is_(t1.c.contains_column(y), True)
+ is_(t2.c.contains_column(y), False)
+ y2 = t2.c.y
+ is_(t2.c.contains_column(y2), True)
+
+ is_(t2.c.contains_column(z), True)
+ is_(t2.c.contains_column(g), False)
+
def test_autoincrement_replace(self):
m = MetaData()