try:
self.driver.set_client_encoding('UNICODE')
- self.driver.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
+ self.driver.autocommit = True
except:
self.driver.close()
self.close()
def begin(self):
- self.driver.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
+ self.driver.autocommit = False
def commit(self):
self.driver.commit()
@contextmanager
def transact(self, synchronous_commit=True):
- self.driver.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
+ self.driver.autocommit = False
try:
with self.cursor() as cursor:
if not synchronous_commit:
self.driver.rollback()
raise
finally:
- self.driver.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
+ self.driver.autocommit = True
def one_(self, statement, context=None):
with self.execute(statement, 2, context) as cursor: