本文整理汇总了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
)