You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hybrid_property.comparator() decorator introduced in this section replaces the use of the hybrid_property.expression() decorator. They cannot be used together.
The example class below allows case-insensitive comparisons on the attribute named word_insensitive:
The CaseInsensitiveComparator above implements part of the ColumnOperators interface. A “coercion” operation like lowercasing can be applied to all comparison operations (i.e. eq, lt, gt, etc.) using Operators.operate():
Building Custom Comparators
The example class below allows
case-insensitive
comparisons on the attribute namedword_insensitive
:Above, SQL expressions against
word_insensitive
will apply theLOWER()
SQL function to both sides:The
CaseInsensitiveComparator
above implements part of theColumnOperators
interface. A “coercion” operation like lowercasing can be applied to all comparison operations (i.e.eq
,lt
,gt
, etc.) usingOperators.operate()
:References:
The text was updated successfully, but these errors were encountered: