jason kirtland wrote:
SA won't automatically commit a transaction you've begun. You need to .commit() explicitly. As Michael said, .commit() will flush changes in the session before committing, so you could switch to calling that.

It can be useful in a transaction to issue a simple .flush(). It updates the database with the Python-side changes queued up in the unit of work, and those updated rows are visible to subsequent queries within the transaction. The changes won't be visible to other db users until (and if) the transaction is eventually committed.

Thank you very much for your detailed explanation! Now I do understand why my session.flush() did not work.

But (from unitofwork.py)
def flush(...):
...
        session.create_transaction(autoflush=False)
        flush_context.transaction = session.transaction
        try:
            flush_context.execute()
        ...
        except:
            session.rollback()
            raise
        session.commit()

So I thought that flush should issue a commit?

fs

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to