sqlalchemy :: types :: Concatenable :: comparator_factory :: Class comparator_factory
[hide private]
[frames] | no frames]

Class comparator_factory


Instance Methods [hide private]
 
_adapt_expression(self, op, other_comparator)
evaluate the return type of <self> <op> <othertype>, and apply any adaptations to the given operator.

Inherited from TypeEngine.comparator_factory: __init__, __reduce__

Inherited from sql.expression._DefaultColumnComparator: operate, reverse_operate, type

Inherited from sql.expression._DefaultColumnComparator (private): _between_impl, _binary_operate, _boolean_compare, _check_literal, _collate_impl, _distinct_impl, _in_impl, _match_impl, _neg_impl, _scalar, _unsupported_impl

Inherited from sql.operators.ColumnOperators: __add__, __div__, __eq__, __ge__, __getitem__, __gt__, __hash__, __le__, __lshift__, __lt__, __mod__, __mul__, __ne__, __neg__, __radd__, __rdiv__, __rmul__, __rshift__, __rsub__, __rtruediv__, __sub__, __truediv__, asc, between, collate, concat, contains, desc, distinct, endswith, ilike, in_, is_, isnot, like, match, notilike, notin_, notlike, nullsfirst, nullslast, startswith

Inherited from sql.operators.Operators: __and__, __invert__, __or__, op

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from sql.expression._DefaultColumnComparator: operators

Inherited from sql.operators.ColumnOperators: timetuple

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_adapt_expression(self, op, other_comparator)

 

evaluate the return type of <self> <op> <othertype>, and apply any adaptations to the given operator.

This method determines the type of a resulting binary expression given two source types and an operator. For example, two :class:`.Column` objects, both of the type :class:`.Integer`, will produce a :class:`.BinaryExpression` that also has the type :class:`.Integer` when compared via the addition (``+``) operator. However, using the addition operator with an :class:`.Integer` and a :class:`.Date` object will produce a :class:`.Date`, assuming "days delta" behavior by the database (in reality, most databases other than Postgresql don't accept this particular operation).

The method returns a tuple of the form <operator>, <type>. The resulting operator and type will be those applied to the resulting :class:`.BinaryExpression` as the final operator and the right-hand side of the expression.

Note that only a subset of operators make usage of :meth:`._adapt_expression`, including math operators and user-defined operators, but not boolean comparison or special SQL keywords like MATCH or BETWEEN.

Overrides: sql.expression._DefaultColumnComparator._adapt_expression
(inherited documentation)