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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy