def __exit__(self, type, value, traceback):
self.close()
+ def begin(self):
+ self.driver.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
+
+ def commit(self):
+ self.driver.commit()
+
+ def rollback(self):
+ self.driver.rollback()
+
@contextmanager
def cursor(self):
cursor = self.driver.cursor(cursor_factory=psycopg2.extras.DictCursor)
with self.execute(statement, 1) as cursor:
yield cursor
- def all(self, statement):
- with self.execute(statement, 1) as cursor:
+ def all(self, statement, context=None):
+ with self.execute(statement, 1, context) as cursor:
return cursor.fetchall()
def one(self, statement, context=None):