def _adapt_expression(self, op, other_comparator):
if isinstance(op, custom_op):
- if op.opstring in ['?', '?&', '?|', '@>', '<@']:
+ if op.opstring in ['?', '@>']:
return op, sqltypes.Boolean
if op.opstring == '->':
return op, sqltypes.Text
"""
return self.expr.op('@>')(other)
-
-
-
-
ischema_names['jsonb'] = JSONB
\ No newline at end of file
},
)
-
def test_unicode_round_trip_python(self):
engine = self._non_native_engine()
self._test_unicode_round_trip(engine)
)
self.jsoncol = self.test_table.c.test_column
+ #Note - add fixture data for arrays []
+
+ def test_where_has_key(self):
+ self._test_where(
+ # hide from 2to3
+ getattr(self.jsoncol, 'has_key')('data'),
+ "test_table.test_column ? %(test_column_1)s"
+ )
+
+ def test_where_contains(self):
+ self._test_where(
+ self.jsoncol.contains('{"k1": "r1v1"}'),
+ "test_table.test_column @> %(test_column_1)s"
+ )
+
class JSONBRoundTripTest(JSONRoundTripTest):
__only_on__ = ('postgresql >= 9.4',)