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 ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé
Classe « Query »

Méthode sqlalchemy.orm.Query.delete

Signature de la méthode delete

def delete(self, synchronize_session: 'SynchronizeSessionArgument' = 'auto', delete_args: 'Optional[Dict[Any, Any]]' = None) -> 'int' 

Description

help(Query.delete)

Perform a DELETE with an arbitrary WHERE clause.

Deletes rows matched by this query from the database.

E.g.::

    sess.query(User).filter(User.age == 25).delete(synchronize_session=False)

    sess.query(User).filter(User.age == 25).delete(
        synchronize_session="evaluate"
    )

.. warning::

    See the section :ref:`orm_expression_update_delete` for important
    caveats and warnings, including limitations when using bulk UPDATE
    and DELETE with mapper inheritance configurations.

:param synchronize_session: chooses the strategy to update the
 attributes on objects in the session.   See the section
 :ref:`orm_expression_update_delete` for a discussion of these
 strategies.

:param delete_args: Optional dictionary, if present will be passed
 to the underlying :func:`_expression.delete` construct as the ``**kw``
 for the object.  May be used to pass dialect-specific arguments such
 as ``mysql_limit``.

 .. versionadded:: 2.0.37

:return: the count of rows matched as returned by the database's
  "row count" feature.

.. seealso::

    :ref:`orm_expression_update_delete`



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é