summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-07-29 13:32:05 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-07-29 13:32:05 -0400
commit405c223ae50e78dacac08783c414619db20df0b7 (patch)
tree479871c932127c666b85b3659498daba1b766778
parent8574d5051adc0c3457ed650a49a25a6c4c4ea3d9 (diff)
downloadsqlalchemy-405c223ae50e78dacac08783c414619db20df0b7.tar.gz
- Fixed 0.9.7 regression caused by :ticket:`3067` in conjunction with
a mis-named unit test such that so-called "schema" types like :class:`.Boolean` and :class:`.Enum` could no longer be pickled. fixes #3144
-rw-r--r--doc/build/changelog/changelog_09.rst9
-rw-r--r--lib/sqlalchemy/sql/elements.py3
-rw-r--r--test/sql/test_types.py4
3 files changed, 14 insertions, 2 deletions
diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst
index 9d5614d68..c63ed7fbb 100644
--- a/doc/build/changelog/changelog_09.rst
+++ b/doc/build/changelog/changelog_09.rst
@@ -14,6 +14,15 @@
:version: 0.9.8
.. change::
+ :tags: bug, sql
+ :versions: 1.0.0
+ :tickets: 3144, 3067
+
+ Fixed 0.9.7 regression caused by :ticket:`3067` in conjunction with
+ a mis-named unit test such that so-called "schema" types like
+ :class:`.Boolean` and :class:`.Enum` could no longer be pickled.
+
+ .. change::
:tags: bug, postgresql
:versions: 1.0.0
:tickets: 3141
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 6114460dc..6cbf583cc 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -3276,6 +3276,9 @@ class _defer_name(_truncated_label):
else:
return super(_defer_name, cls).__new__(cls, value)
+ def __reduce__(self):
+ return self.__class__, (util.text_type(self), )
+
class _defer_none_name(_defer_name):
"""indicate a 'deferred' name that was ultimately the value None."""
diff --git a/test/sql/test_types.py b/test/sql/test_types.py
index 03d399763..efa0f90ae 100644
--- a/test/sql/test_types.py
+++ b/test/sql/test_types.py
@@ -234,9 +234,9 @@ class TypeAffinityTest(fixtures.TestBase):
assert t1.dialect_impl(d)._type_affinity is postgresql.UUID
-class PickleMetadataTest(fixtures.TestBase):
+class PickleTypesTest(fixtures.TestBase):
- def testmeta(self):
+ def test_pickle_types(self):
for loads, dumps in picklers():
column_types = [
Column('Boo', Boolean()),