本文整理匯總了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},
)