From 5f57cb66393bb2dc4328acc3398b298fc6c541bf Mon Sep 17 00:00:00 2001 From: Arseny Sher Date: Thu, 16 Nov 2017 12:49:46 +0300 Subject: [PATCH] commit=True by default in PostgresNode.execute() and document it. Old default could lead to astonishing "where are my damned rows?" emotions. --- README.md | 2 +- testgres/testgres.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fc285cf6..3e1034e9 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Finally our temporary cluster is able to process queries. There are four ways to * `node.psql(database, query)` - runs query via `psql` command and returns tuple `(error code, stdout, stderr)` * `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. -* `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. +* `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. * `node.connect(database='postgres')` - returns connection wrapper (`NodeConnection`) capable of running several queries within a single transaction. The last one is the most powerful: you can use `begin(isolation_level)`, `commit()` and `rollback()`: diff --git a/testgres/testgres.py b/testgres/testgres.py index 14c135bd..4a25c80e 100644 --- a/testgres/testgres.py +++ b/testgres/testgres.py @@ -962,7 +962,7 @@ def poll_query_until(self, raise TimeoutException('Query timeout') - def execute(self, dbname, query, username=None, commit=False): + def execute(self, dbname, query, username=None, commit=True): """ Execute a query and return all rows as list.