Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé
Module « sqlalchemy »

Fonction between - module sqlalchemy

Signature de la fonction between

def between(expr: '_ColumnExpressionOrLiteralArgument[_T]', lower_bound: 'Any', upper_bound: 'Any', symmetric: 'bool' = False) -> 'BinaryExpression[bool]' 

Description

help(sqlalchemy.between)

Produce a ``BETWEEN`` predicate clause.

E.g.::

    from sqlalchemy import between

    stmt = select(users_table).where(between(users_table.c.id, 5, 7))

Would produce SQL resembling:

.. sourcecode:: sql

    SELECT id, name FROM user WHERE id BETWEEN :id_1 AND :id_2

The :func:`.between` function is a standalone version of the
:meth:`_expression.ColumnElement.between` method available on all
SQL expressions, as in::

    stmt = select(users_table).where(users_table.c.id.between(5, 7))

All arguments passed to :func:`.between`, including the left side
column expression, are coerced from Python scalar values if a
the value is not a :class:`_expression.ColumnElement` subclass.
For example,
three fixed values can be compared as in::

    print(between(5, 3, 7))

Which would produce::

    :param_1 BETWEEN :param_2 AND :param_3

:param expr: a column expression, typically a
 :class:`_expression.ColumnElement`
 instance or alternatively a Python scalar expression to be coerced
 into a column expression, serving as the left side of the ``BETWEEN``
 expression.

:param lower_bound: a column or Python scalar expression serving as the
 lower bound of the right side of the ``BETWEEN`` expression.

:param upper_bound: a column or Python scalar expression serving as the
 upper bound of the right side of the ``BETWEEN`` expression.

:param symmetric: if True, will render " BETWEEN SYMMETRIC ". Note
 that not all databases support this syntax.

.. seealso::

    :meth:`_expression.ColumnElement.between`



Vous êtes un professionnel et vous avez besoin d'une formation ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé