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 :

Classe « Session »

Méthode sqlalchemy.orm.Session.commit

Signature de la méthode commit

def commit(self) 

Description

commit.__doc__

Flush pending changes and commit the current transaction.

        If no transaction is in progress, the method will first
        "autobegin" a new transaction and commit.

        If :term:`1.x-style` use is in effect and there are currently
        SAVEPOINTs in progress via :meth:`_orm.Session.begin_nested`,
        the operation will release the current SAVEPOINT but not commit
        the outermost database transaction.

        If :term:`2.0-style` use is in effect via the
        :paramref:`_orm.Session.future` flag, the outermost database
        transaction is committed unconditionally, automatically releasing any
        SAVEPOINTs in effect.

        When using legacy "autocommit" mode, this method is only
        valid to call if a transaction is actually in progress, else
        an error is raised.   Similarly, when using legacy "subtransactions",
        the method will instead close out the current "subtransaction",
        rather than the actual database transaction, if a transaction
        is in progress.

        .. seealso::

            :ref:`session_committing`

            :ref:`unitofwork_transaction`