本文整理匯總了Python中sqlalchemy.sql.operators.concat_op方法的典型用法代碼示例。如果您正苦於以下問題:Python operators.concat_op方法的具體用法?Python operators.concat_op怎麽用?Python operators.concat_op使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sqlalchemy.sql.operators
的用法示例。
在下文中一共展示了operators.concat_op方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_concatenable_adapt
# 需要導入模塊: from sqlalchemy.sql import operators [as 別名]
# 或者: from sqlalchemy.sql.operators import concat_op [as 別名]
def test_concatenable_adapt(self):
class TypeOne(Concatenable, TypeEngine):
pass
class TypeTwo(Concatenable, TypeEngine):
pass
class TypeThree(TypeEngine):
pass
expr = column("x", TypeOne()) - column("y", TypeTwo())
is_(expr.type._type_affinity, TypeOne)
is_(expr.operator, operator.sub)
expr = column("x", TypeOne()) + column("y", TypeTwo())
is_(expr.type._type_affinity, TypeOne)
is_(expr.operator, operators.concat_op)
expr = column("x", TypeOne()) - column("y", TypeThree())
is_(expr.type._type_affinity, TypeOne)
is_(expr.operator, operator.sub)
expr = column("x", TypeOne()) + column("y", TypeThree())
is_(expr.type._type_affinity, TypeOne)
is_(expr.operator, operator.add)
示例2: _adapt_expression
# 需要導入模塊: from sqlalchemy.sql import operators [as 別名]
# 或者: from sqlalchemy.sql.operators import concat_op [as 別名]
def _adapt_expression(self, op, other_comparator):
if (op is operators.add and
isinstance(
other_comparator,
(Concatenable.Comparator, NullType.Comparator)
)):
return operators.concat_op, self.expr.type
else:
return super(Concatenable.Comparator, self)._adapt_expression(
op, other_comparator)
示例3: _adapt_expression
# 需要導入模塊: from sqlalchemy.sql import operators [as 別名]
# 或者: from sqlalchemy.sql.operators import concat_op [as 別名]
def _adapt_expression(self, op, other_comparator):
if op is operators.add and isinstance(
other_comparator,
(Concatenable.Comparator, NullType.Comparator),
):
return operators.concat_op, self.expr.type
else:
return super(Concatenable.Comparator, self)._adapt_expression(
op, other_comparator
)