diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-30 21:20:20 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-30 21:20:20 -0400 |
commit | e16ede8cae00fd5cbbd5fb33d63c14df0153c2bc (patch) | |
tree | 3116fa46093c735c59982600489b6d2a80c112fe /lib/sqlalchemy/sql/default_comparator.py | |
parent | efd3c311e0c62ae976733cf97e495a3c8ca76906 (diff) | |
download | sqlalchemy-e16ede8cae00fd5cbbd5fb33d63c14df0153c2bc.tar.gz |
- Added new flag :paramref:`.expression.between.symmetric`, when set to True
renders "BETWEEN SYMMETRIC". Also added a new negation operator
"notbetween_op", which now allows an expression like ``~col.between(x, y)``
to render as "col NOT BETWEEN x AND y", rather than a parentheiszed NOT
string. fixes #2990
Diffstat (limited to 'lib/sqlalchemy/sql/default_comparator.py')
-rw-r--r-- | lib/sqlalchemy/sql/default_comparator.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/default_comparator.py b/lib/sqlalchemy/sql/default_comparator.py index 6d595450b..6bc7fb580 100644 --- a/lib/sqlalchemy/sql/default_comparator.py +++ b/lib/sqlalchemy/sql/default_comparator.py @@ -214,7 +214,11 @@ class _DefaultColumnComparator(operators.ColumnOperators): self._check_literal(expr, operators.and_, cright), operator=operators.and_, group=False, group_contents=False), - operators.between_op) + op, + negate=operators.notbetween_op + if op is operators.between_op + else operators.between_op, + modifiers=kw) def _collate_impl(self, expr, op, other, **kw): return collate(expr, other) @@ -255,6 +259,7 @@ class _DefaultColumnComparator(operators.ColumnOperators): "match_op": (_match_impl,), "distinct_op": (_distinct_impl,), "between_op": (_between_impl, ), + "notbetween_op": (_between_impl, ), "neg": (_neg_impl,), "getitem": (_unsupported_impl,), "lshift": (_unsupported_impl,), |