本文整理汇总了Python中sqlalchemy.sql.operators.lt方法的典型用法代码示例。如果您正苦于以下问题:Python operators.lt方法的具体用法?Python operators.lt怎么用?Python operators.lt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy.sql.operators
的用法示例。
在下文中一共展示了operators.lt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: any
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def any(self, other, operator=operators.eq):
"""Return ``other operator ANY (array)`` clause.
Argument places are switched, because ANY requires array
expression to be on the right hand-side.
E.g.::
from sqlalchemy.sql import operators
conn.execute(
select([table.c.data]).where(
table.c.data.any(7, operator=operators.lt)
)
)
:param other: expression to be compared
:param operator: an operator object from the
:mod:`sqlalchemy.sql.operators`
package, defaults to :func:`.operators.eq`.
.. seealso::
:class:`.postgresql.Any`
:meth:`.postgresql.ARRAY.Comparator.all`
"""
return Any(other, self.expr, operator=operator)
示例2: all
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def all(self, other, operator=operators.eq):
"""Return ``other operator ALL (array)`` clause.
Argument places are switched, because ALL requires array
expression to be on the right hand-side.
E.g.::
from sqlalchemy.sql import operators
conn.execute(
select([table.c.data]).where(
table.c.data.all(7, operator=operators.lt)
)
)
:param other: expression to be compared
:param operator: an operator object from the
:mod:`sqlalchemy.sql.operators`
package, defaults to :func:`.operators.eq`.
.. seealso::
:class:`.postgresql.All`
:meth:`.postgresql.ARRAY.Comparator.any`
"""
return All(other, self.expr, operator=operator)
示例3: any
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def any(self, elements, other, operator=None):
"""Return ``other operator ANY (array)`` clause.
Argument places are switched, because ANY requires array
expression to be on the right hand-side.
E.g.::
from sqlalchemy.sql import operators
conn.execute(
select([table.c.data]).where(
table.c.data.any(7, operator=operators.lt)
)
)
:param other: expression to be compared
:param operator: an operator object from the
:mod:`sqlalchemy.sql.operators`
package, defaults to :func:`.operators.eq`.
.. seealso::
:func:`.sql.expression.any_`
:meth:`.types.ARRAY.Comparator.all`
"""
operator = operator if operator else operators.eq
return operator(
elements._literal_as_binds(other),
elements.CollectionAggregate._create_any(self.expr)
)
示例4: all
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def all(self, elements, other, operator=None):
"""Return ``other operator ALL (array)`` clause.
Argument places are switched, because ALL requires array
expression to be on the right hand-side.
E.g.::
from sqlalchemy.sql import operators
conn.execute(
select([table.c.data]).where(
table.c.data.all(7, operator=operators.lt)
)
)
:param other: expression to be compared
:param operator: an operator object from the
:mod:`sqlalchemy.sql.operators`
package, defaults to :func:`.operators.eq`.
.. seealso::
:func:`.sql.expression.all_`
:meth:`.types.ARRAY.Comparator.any`
"""
operator = operator if operator else operators.eq
return operator(
elements._literal_as_binds(other),
elements.CollectionAggregate._create_all(self.expr)
)
示例5: any
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def any(self, other, operator=None):
"""Return ``other operator ANY (array)`` clause.
Argument places are switched, because ANY requires array
expression to be on the right hand-side.
E.g.::
from sqlalchemy.sql import operators
conn.execute(
select([table.c.data]).where(
table.c.data.any(7, operator=operators.lt)
)
)
:param other: expression to be compared
:param operator: an operator object from the
:mod:`sqlalchemy.sql.operators`
package, defaults to :func:`.operators.eq`.
.. seealso::
:func:`_expression.any_`
:meth:`.types.ARRAY.Comparator.all`
"""
elements = util.preloaded.sql_elements
operator = operator if operator else operators.eq
return operator(
coercions.expect(roles.ExpressionElementRole, other),
elements.CollectionAggregate._create_any(self.expr),
)
示例6: all
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def all(self, other, operator=None):
"""Return ``other operator ALL (array)`` clause.
Argument places are switched, because ALL requires array
expression to be on the right hand-side.
E.g.::
from sqlalchemy.sql import operators
conn.execute(
select([table.c.data]).where(
table.c.data.all(7, operator=operators.lt)
)
)
:param other: expression to be compared
:param operator: an operator object from the
:mod:`sqlalchemy.sql.operators`
package, defaults to :func:`.operators.eq`.
.. seealso::
:func:`_expression.all_`
:meth:`.types.ARRAY.Comparator.any`
"""
elements = util.preloaded.sql_elements
operator = operator if operator else operators.eq
return operator(
coercions.expect(roles.ExpressionElementRole, other),
elements.CollectionAggregate._create_all(self.expr),
)
示例7: test_array_any
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def test_array_any(self):
col = column("x", postgresql.ARRAY(Integer))
self.assert_compile(
select([col.any(7, operator=operators.lt)]),
"SELECT %(param_1)s < ANY (x) AS anon_1",
checkparams={"param_1": 7},
)
示例8: test_array_all
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def test_array_all(self):
col = column("x", postgresql.ARRAY(Integer))
self.assert_compile(
select([col.all(7, operator=operators.lt)]),
"SELECT %(param_1)s < ALL (x) AS anon_1",
checkparams={"param_1": 7},
)
示例9: test_array
# 需要导入模块: from sqlalchemy.sql import operators [as 别名]
# 或者: from sqlalchemy.sql.operators import lt [as 别名]
def test_array(self):
c = Column("x", postgresql.ARRAY(Integer))
self.assert_compile(
cast(c, postgresql.ARRAY(Integer)), "CAST(x AS INTEGER[])"
)
self.assert_compile(c[5], "x[%(x_1)s]", checkparams={"x_1": 5})
self.assert_compile(
c[5:7], "x[%(x_1)s:%(x_2)s]", checkparams={"x_2": 7, "x_1": 5}
)
self.assert_compile(
c[5:7][2:3],
"x[%(x_1)s:%(x_2)s][%(param_1)s:%(param_2)s]",
checkparams={"x_2": 7, "x_1": 5, "param_1": 2, "param_2": 3},
)
self.assert_compile(
c[5:7][3],
"x[%(x_1)s:%(x_2)s][%(param_1)s]",
checkparams={"x_2": 7, "x_1": 5, "param_1": 3},
)
self.assert_compile(
c.contains([1]), "x @> %(x_1)s", checkparams={"x_1": [1]}
)
self.assert_compile(
c.contained_by([2]), "x <@ %(x_1)s", checkparams={"x_1": [2]}
)
self.assert_compile(
c.overlap([3]), "x && %(x_1)s", checkparams={"x_1": [3]}
)
self.assert_compile(
postgresql.Any(4, c),
"%(param_1)s = ANY (x)",
checkparams={"param_1": 4},
)
self.assert_compile(
c.any(5, operator=operators.ne),
"%(param_1)s != ANY (x)",
checkparams={"param_1": 5},
)
self.assert_compile(
postgresql.All(6, c, operator=operators.gt),
"%(param_1)s > ALL (x)",
checkparams={"param_1": 6},
)
self.assert_compile(
c.all(7, operator=operators.lt),
"%(param_1)s < ALL (x)",
checkparams={"param_1": 7},
)