"getitem": (_getitem_impl, util.EMPTY_DICT),
"lshift": (_unsupported_impl, util.EMPTY_DICT),
"rshift": (_unsupported_impl, util.EMPTY_DICT),
+ "matmul": (_unsupported_impl, util.EMPTY_DICT),
"contains": (_unsupported_impl, util.EMPTY_DICT),
"regexp_match_op": (_regexp_match_impl, util.EMPTY_DICT),
"not_regexp_match_op": (_regexp_match_impl, util.EMPTY_DICT),
from operator import le as _uncast_le
from operator import lshift as _uncast_lshift
from operator import lt as _uncast_lt
+from operator import matmul as _uncast_matmul
from operator import mod as _uncast_mod
from operator import mul as _uncast_mul
from operator import ne as _uncast_ne
le = cast(OperatorType, _uncast_le)
lshift = cast(OperatorType, _uncast_lshift)
lt = cast(OperatorType, _uncast_lt)
+matmul = cast(OperatorType, _uncast_matmul)
mod = cast(OperatorType, _uncast_mod)
mul = cast(OperatorType, _uncast_mul)
ne = cast(OperatorType, _uncast_ne)
"""
return self.operate(rshift, other)
+ def __matmul__(self, other: Any) -> ColumnOperators:
+ """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(matmul, other)
+
def concat(self, other: Any) -> ColumnOperators:
"""Implement the 'concat' operator.
self.assert_compile(Column("x", MyType()) >> 5, "x -> :x_1")
+ def test_matmul(self):
+ class MyType(UserDefinedType):
+ cache_ok = True
+
+ class comparator_factory(UserDefinedType.Comparator):
+ def __matmul__(self, other):
+ return self.op("->")(other)
+
+ self.assert_compile(Column("x", MyType()) @ 5, "x -> :x_1")
+
class JSONIndexOpTest(fixtures.TestBase, testing.AssertsCompiledSQL):
def setup_test(self):