summaryrefslogtreecommitdiff
path: root/test/dialect
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-05-25 13:58:08 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-05-25 13:58:08 -0400
commite384347ffb9b29fca146df54284e96a567adae9c (patch)
treebac85461583669e0e149407934ba97182fefd610 /test/dialect
parent95b10c4e8e59cf2509ba5d90a03341d74f93d164 (diff)
downloadsqlalchemy-e384347ffb9b29fca146df54284e96a567adae9c.tar.gz
- Added the ``hashable=False`` flag to the PG :class:`.HSTORE` type, which
is needed to allow the ORM to skip over trying to "hash" an ORM-mapped HSTORE column when requesting it in a mixed column/entity list. Patch courtesy Gunnlaugur Þór Briem. Fixes #3053
Diffstat (limited to 'test/dialect')
-rw-r--r--test/dialect/postgresql/test_types.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index b30847bce..b94cc040a 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -1375,6 +1375,21 @@ class HStoreRoundTripTest(fixtures.TablesTest):
)
self._assert_data([{r'key \"foo\"': r'value \"bar"\ xyz'}])
+ def test_orm_round_trip(self):
+ from sqlalchemy import orm
+ class Data(object):
+ def __init__(self, name, data):
+ self.name = name
+ self.data = data
+ orm.mapper(Data, self.tables.data_table)
+ s = orm.Session(testing.db)
+ d = Data(name='r1', data={"key1": "value1", "key2": "value2",
+ "key3": "value3"})
+ s.add(d)
+ eq_(
+ s.query(Data.data, Data).all(),
+ [(d.data, d)]
+ )
class _RangeTypeMixin(object):
__requires__ = 'range_types',
__dialect__ = 'postgresql+psycopg2'