residual = residual[:-1] + '[...]'
return "After %r, could not parse residual at position %d: %r" % (
- parsed_tail, pos, residual)
+ parsed_tail, pos, residual)
def _parse_hstore(hstore_str):
__visit_name__ = 'HSTORE'
- class comparator_factory(sqltypes.TypeEngine.Comparator):
+ class comparator_factory(sqltypes.Concatenable.Comparator):
"""Define comparison operations for :class:`.HSTORE`."""
def has_key(self, other):
"""
return self.expr.op('->', precedence=5)(other)
- def __add__(self, other):
- """HStore expression. Merge the left and right hstore expressions,
- with duplicate keys taking the value from the right expression.
- """
- return self.expr.concat(other)
-
def delete(self, key):
"""HStore expression. Returns the contents of this hstore with the
given key deleted. Note that the key may be a SQLA expression.
return op, sqltypes.Boolean
elif op.opstring == '->':
return op, sqltypes.Text
- return op, other_comparator.type
+ return sqltypes.Concatenable.Comparator.\
+ _adapt_expression(self, op, other_comparator)
def bind_processor(self, dialect):
def process(value):
'"key2"=>"value2", "key1"=>"value1", '
'crapcrapcrap, "key3"=>"value3"'
)
+
def test_result_deserialize_default(self):
from sqlalchemy.engine import default
def test_cols_concat_op(self):
self._test_cols(
- self.hashcol + self.hashcol,
- "test_table.hash || test_table.hash AS anon_1",
+ hstore('foo', 'bar') + self.hashcol,
+ "hstore(%(param_1)s, %(param_2)s) || test_table.hash AS anon_1",
True
)
True
)
+
class HStoreRoundTripTest(fixtures.TablesTest):
__requires__ = 'hstore',
__dialect__ = 'postgresql'