diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-10-30 20:02:21 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-10-30 20:02:21 -0400 |
| commit | 8965f3021539f3132311d6277aab475d6c44ebbe (patch) | |
| tree | 9cf1a9c400192a683d99e43c227ad7345712e3ba /lib/sqlalchemy | |
| parent | fd4289c5829d6498495ac59fe1dccb23b4975281 (diff) | |
| download | sqlalchemy-8965f3021539f3132311d6277aab475d6c44ebbe.tar.gz | |
- add notes that @comparator and @expression don't go together.
Change-Id: I3fb366f8b49454453e4b6dada565c24c5ccb975e
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/ext/hybrid.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/hybrid.py b/lib/sqlalchemy/ext/hybrid.py index 141a64599..243ef961d 100644 --- a/lib/sqlalchemy/ext/hybrid.py +++ b/lib/sqlalchemy/ext/hybrid.py @@ -384,6 +384,10 @@ behavior of each SQLAlchemy expression operator individually. They are useful when creating custom types that have some highly idiosyncratic behavior on the SQL side. +.. note:: The :meth:`.hybrid_property.comparator` decorator introduced + in this section **replaces** the use of the + :meth:`.hybrid_property.expression` decorator. They cannot be used together. + The example class below allows case-insensitive comparisons on the attribute named ``word_insensitive``:: @@ -972,6 +976,10 @@ class hybrid_property(interfaces.InspectionAttrInfo): The return value of the decorated method should be an instance of :class:`~.hybrid.Comparator`. + .. note:: The :meth:`.hybrid_property.comparator` decorator + **replaces** the use of the :meth:`.hybrid_property.expression` + decorator. They cannot be used together. + When a hybrid is invoked at the class level, the :class:`~.hybrid.Comparator` object given here is wrapped inside of a specialized :class:`.QueryableAttribute`, which is the same kind of |
