diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-09-04 10:44:37 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-09-04 10:44:37 -0400 |
commit | bc9ff8fcc9e13fe50714c95e3f56c9144aba94f5 (patch) | |
tree | 7879eadd68a537ca4531ac48793222fc8d507dea /lib/sqlalchemy/sql | |
parent | 9e612f111b9645f4958e3ef0595d9e19bd9e5ae3 (diff) | |
download | sqlalchemy-bc9ff8fcc9e13fe50714c95e3f56c9144aba94f5.tar.gz |
`lshift` (<<) and `rshift` (>>) are also supported as optional operators.
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r-- | lib/sqlalchemy/sql/expression.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/operators.py | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 4edbeafe2..7ef8e5b53 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -2107,6 +2107,8 @@ class _DefaultColumnComparator(operators.ColumnOperators): "between_op": (_between_impl, ), "neg": (_neg_impl,), "getitem": (_unsupported_impl,), + "lshift": (_unsupported_impl,), + "rshift": (_unsupported_impl,), } diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index ba33d016a..38936231d 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -11,7 +11,7 @@ from operator import ( and_, or_, inv, add, mul, sub, mod, truediv, lt, le, ne, gt, ge, eq, neg, - getitem + getitem, lshift, rshift ) # Py2K @@ -315,6 +315,24 @@ class ColumnOperators(Operators): """ return self.operate(getitem, index) + def __lshift__(self, other): + """implement the << operator. + + Not used by SQLAlchemy core, this is provided + for custom operator systems which want to use + << as an extension point. + """ + return self.operate(lshift, other) + + def __rshift__(self, other): + """implement the >> operator. + + Not used by SQLAlchemy core, this is provided + for custom operator systems which want to use + >> as an extension point. + """ + return self.operate(rshift, other) + def concat(self, other): """Implement the 'concat' operator. |