sqlalchemy :: sql :: sqltypes :: Concatenable :: Comparator :: Class Comparator
[hide private]
[frames] | no frames]

Class Comparator


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 type_api.TypeEngine.Comparator: __init__, __reduce__, operate, reverse_operate

Inherited from operators.ColumnOperators: __add__, __contains__, __div__, __eq__, __ge__, __getitem__, __gt__, __hash__, __le__, __lshift__, __lt__, __mod__, __mul__, __ne__, __neg__, __radd__, __rdiv__, __rmod__, __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 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 type_api.TypeEngine.Comparator: BOOLEANTYPE, default_comparator

Inherited from operators.ColumnOperators: timetuple

Properties [hide private]

Inherited from type_api.TypeEngine.Comparator: expr, type

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: type_api.TypeEngine.Comparator._adapt_expression
(inherited documentation)