From e384347ffb9b29fca146df54284e96a567adae9c Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 25 May 2014 13:58:08 -0400 Subject: =?UTF-8?q?-=20Added=20the=20``hashable=3DFalse``=20flag=20to=20th?= =?UTF-8?q?e=20PG=20:class:`.HSTORE`=20type,=20which=20is=20needed=20to=20?= =?UTF-8?q?allow=20the=20ORM=20to=20skip=20over=20trying=20to=20"hash"=20a?= =?UTF-8?q?n=20ORM-mapped=20HSTORE=20column=20when=20requesting=20it=20in?= =?UTF-8?q?=20a=20mixed=20column/entity=20list.=20Patch=20courtesy=20Gunnl?= =?UTF-8?q?augur=20=C3=9E=C3=B3r=20Briem.=20=20Fixes=20#3053?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/dialect/postgresql/test_types.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/dialect/postgresql') 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' -- cgit v1.2.1