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 fondamentaux
Voir le programme détaillé
Classe « scoped_session »

Méthode sqlalchemy.orm.scoped_session.commit

Signature de la méthode commit

def commit(self) -> 'None' 

Description

help(scoped_session.commit)

Flush pending changes and commit the current transaction.

.. container:: class_bases

    Proxied for the :class:`_orm.Session` class on
    behalf of the :class:`_orm.scoping.scoped_session` class.

When the COMMIT operation is complete, all objects are fully
:term:`expired`, erasing their internal contents, which will be
automatically re-loaded when the objects are next accessed. In the
interim, these objects are in an expired state and will not function if
they are :term:`detached` from the :class:`.Session`. Additionally,
this re-load operation is not supported when using asyncio-oriented
APIs. The :paramref:`.Session.expire_on_commit` parameter may be used
to disable this behavior.

When there is no transaction in place for the :class:`.Session`,
indicating that no operations were invoked on this :class:`.Session`
since the previous call to :meth:`.Session.commit`, the method will
begin and commit an internal-only "logical" transaction, that does not
normally affect the database unless pending flush changes were
detected, but will still invoke event handlers and object expiration
rules.

The outermost database transaction is committed unconditionally,
automatically releasing any SAVEPOINTs in effect.

.. seealso::

    :ref:`session_committing`

    :ref:`unitofwork_transaction`

    :ref:`asyncio_orm_avoid_lazyloads`




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