Skip to content

Commit aa06ad4

Browse files
committed
Mention the new parameters in the module docstrings.
1 parent 6fd1b4c commit aa06ad4

5 files changed

Lines changed: 23 additions & 8 deletions

File tree

DBUtils/PersistentDB.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
Whenever the limit is reached, the connection will be reset.
3737
setsession: an optional list of SQL commands that may serve to
3838
prepare the session, e.g. ["set datestyle to german", ...].
39+
failures: an optional exception class or a tuple of exception classes
40+
for which the connection failover mechanism shall be applied,
41+
if the default (OperationalError, InternalError) is not adequate
42+
closeable: if this is set to true, then closing connections will
43+
be allowed, but by default this will be silently ignored
3944
4045
The creator function or the connect function of the DB-API 2 compliant
4146
database module specified as the creator will receive any additional

DBUtils/PersistentPg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
the connection is automatically reset (closed and reopened).
3838
setsession: An optional list of SQL commands that may serve to
3939
prepare the session, e.g. ["set datestyle to german", ...]
40+
closeable: if this is set to true, then closing connections will
41+
be allowed, but by default this will be silently ignored
4042
4143
Additionally, you have to pass the parameters for the actual
4244
PostgreSQL connection which are passed via PyGreSQL,

DBUtils/PooledDB.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
the connection is automatically reset (closed and reopened).
4949
setsession: an optional list of SQL commands that may serve to
5050
prepare the session, e.g. ["set datestyle to german", ...]
51+
failures: an optional exception class or a tuple of exception classes
52+
for which the connection failover mechanism shall be applied,
53+
if the default (OperationalError, InternalError) is not adequate
5154
5255
The creator function or the connect function of the DB-API 2 compliant
5356
database module specified as the creator will receive any additional

DBUtils/SteadyDB.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@
4646
implementing failover mechanisms and load balancing strategies.
4747
4848
You may also specify a usage limit as the second parameter
49-
(set it to 0 if you prefer unlimited usage), and an optional
49+
(set it to None if you prefer unlimited usage), an optional
5050
list of commands that may serve to prepare the session as a
51-
third parameter. When the connection to the database is lost
52-
or has been used too often, it will be transparently reset
53-
in most situations, without further notice.
51+
third parameter, the exception classes for which the failover
52+
mechanism shall be applied, and you can specify whether is is
53+
allowed to close the connection (by default this is true).
54+
When the connection to the database is lost or has been used
55+
too often, it will be transparently reset in most situations,
56+
without further notice.
5457
5558
import pgdb # import used DB-API 2 module
5659
from DBUtils.SteadyDB import connect

DBUtils/SteadyPg.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
You can use the class SteadyPgConnection in the same way as you
3636
would use the class DB from the classic PyGreSQL API module db.
3737
The only difference is that you may specify a usage limit as the
38-
first paramenter when you open a connection (set it to 0
38+
first paramenter when you open a connection (set it to None
3939
if you prefer unlimited usage), and an optional list of commands
40-
that may serve to prepare the session as the second parameter.
41-
When the connection to the PostgreSQL database is lost or has been
42-
used too often, it will be automatically reset, without further notice.
40+
that may serve to prepare the session as the second parameter,
41+
and you can specify whether is is allowed to close the connection
42+
(by default this is true). When the connection to the PostgreSQL
43+
database is lost or has been used too often, it will be automatically
44+
reset, without further notice.
4345
4446
from DBUtils.SteadyPg import SteadyPgConnection
4547
db = SteadyPgConnection(10000, ["set datestyle to german"],

0 commit comments

Comments
 (0)