Skip to content

Commit a1ac4fb

Browse files
authored
Merge pull request #28 from arssher/master
commit=True by default in PostgresNode.execute() and document it.
2 parents aaf73ff + 5f57cb6 commit a1ac4fb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Finally our temporary cluster is able to process queries. There are four ways to
9898

9999
* `node.psql(database, query)` - runs query via `psql` command and returns tuple `(error code, stdout, stderr)`
100100
* `node.safe_psql(database, query)` - same as `psql()` except that it returns only `stdout`. If an error occures during the execution, an exception will be thrown.
101-
* `node.execute(database, query)` - connects to postgresql server using `psycopg2` or `pg8000` library (depends on which is installed in your system) and returns two-dimensional array with data.
101+
* `node.execute(database, query, username=None, commit=True)` - connects to postgresql server using `psycopg2` or `pg8000` library (depends on which is installed in your system) and returns two-dimensional array with data.
102102
* `node.connect(database='postgres')` - returns connection wrapper (`NodeConnection`) capable of running several queries within a single transaction.
103103

104104
The last one is the most powerful: you can use `begin(isolation_level)`, `commit()` and `rollback()`:

‎testgres/testgres.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ def poll_query_until(self,
962962

963963
raise TimeoutException('Query timeout')
964964

965-
def execute(self, dbname, query, username=None, commit=False):
965+
def execute(self, dbname, query, username=None, commit=True):
966966
"""
967967
Execute a query and return all rows as list.
968968

0 commit comments

Comments
 (0)