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 ? Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé
Classe « GenerativeSelect »

Méthode sqlalchemy.GenerativeSelect.slice

Signature de la méthode slice

def slice(self, start: 'int', stop: 'int') -> 'Self' 

Description

help(GenerativeSelect.slice)

Apply LIMIT / OFFSET to this statement based on a slice.

The start and stop indices behave like the argument to Python's
built-in :func:`range` function. This method provides an
alternative to using ``LIMIT``/``OFFSET`` to get a slice of the
query.

For example, ::

    stmt = select(User).order_by(User.id).slice(1, 3)

renders as

.. sourcecode:: sql

   SELECT users.id AS users_id,
          users.name AS users_name
   FROM users ORDER BY users.id
   LIMIT ? OFFSET ?
   (2, 1)

.. note::

   The :meth:`_sql.GenerativeSelect.slice` method will replace
   any clause applied with :meth:`_sql.GenerativeSelect.fetch`.

.. versionadded:: 1.4  Added the :meth:`_sql.GenerativeSelect.slice`
   method generalized from the ORM.

.. seealso::

   :meth:`_sql.GenerativeSelect.limit`

   :meth:`_sql.GenerativeSelect.offset`

   :meth:`_sql.GenerativeSelect.fetch`



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