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é
Classe « GenerativeSelect »

Méthode sqlalchemy.GenerativeSelect.with_for_update

Signature de la méthode with_for_update

def with_for_update(self, *, nowait: 'bool' = False, read: 'bool' = False, of: 'Optional[_ForUpdateOfArgument]' = None, skip_locked: 'bool' = False, key_share: 'bool' = False) -> 'Self' 

Description

help(GenerativeSelect.with_for_update)

Specify a ``FOR UPDATE`` clause for this
:class:`_expression.GenerativeSelect`.

E.g.::

    stmt = select(table).with_for_update(nowait=True)

On a database like PostgreSQL or Oracle Database, the above would
render a statement like:

.. sourcecode:: sql

    SELECT table.a, table.b FROM table FOR UPDATE NOWAIT

on other backends, the ``nowait`` option is ignored and instead
would produce:

.. sourcecode:: sql

    SELECT table.a, table.b FROM table FOR UPDATE

When called with no arguments, the statement will render with
the suffix ``FOR UPDATE``.   Additional arguments can then be
provided which allow for common database-specific
variants.

:param nowait: boolean; will render ``FOR UPDATE NOWAIT`` on Oracle
 Database and PostgreSQL dialects.

:param read: boolean; will render ``LOCK IN SHARE MODE`` on MySQL,
 ``FOR SHARE`` on PostgreSQL.  On PostgreSQL, when combined with
 ``nowait``, will render ``FOR SHARE NOWAIT``.

:param of: SQL expression or list of SQL expression elements,
 (typically :class:`_schema.Column` objects or a compatible expression,
 for some backends may also be a table expression) which will render
 into a ``FOR UPDATE OF`` clause; supported by PostgreSQL, Oracle
 Database, some MySQL versions and possibly others. May render as a
 table or as a column depending on backend.

:param skip_locked: boolean, will render ``FOR UPDATE SKIP LOCKED`` on
 Oracle Database and PostgreSQL dialects or ``FOR SHARE SKIP LOCKED``
 if ``read=True`` is also specified.

:param key_share: boolean, will render ``FOR NO KEY UPDATE``,
 or if combined with ``read=True`` will render ``FOR KEY SHARE``,
 on the PostgreSQL dialect.



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