Project

General

Profile

Actions

Task #457

open

use driver-native autocommit mode instead of our custom autocommit implementation

Added by Aaron Marcuse-Kubitza over 11 years ago. Updated over 11 years ago.

Status:
New
Priority:
Normal
Start date:
07/30/2012
Due date:
% Done:

0%

Estimated time:
Activity type:

Description

  • Should improve performance by avoiding creating unnecessary transactions
  • In commit mode, also removes the need to auto-rollback failed queries

In sql.py: DbConn._db(): Configure connection, replace1:

            # Record that a transaction is already open
            self._savepoint += 1

            # Configure connection
            if hasattr(self.db, 'set_isolation_level'):
                import psycopg2.extensions
                self.db.set_isolation_level(
                    psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
with:
            # Record that a transaction is already open
            if not self.autocommit: self._savepoint += 1

            # Configure connection

            # Set autocommit mode
            if self.autocommit:
                if hasattr(self.db, 'set_isolation_level'):
                    import psycopg2.extensions
                    self.db.set_isolation_level(
                        psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
                elif hasattr(self.db, 'autocommit'): self.db.autocommit(1)

In sql.py: DbConn.close(): Record that the automatic transaction is now closed, replace1:

        self._savepoint -= 1
with:
        if not self.autocommit: self._savepoint -= 1

1 r3689

Actions #1

Updated by Aaron Marcuse-Kubitza over 11 years ago

  • Description updated (diff)
Actions

Also available in: Atom PDF