File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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,
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 4646implementing failover mechanisms and load balancing strategies.
4747
4848You 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
5050list 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
Original file line number Diff line number Diff line change 3535You can use the class SteadyPgConnection in the same way as you
3636would use the class DB from the classic PyGreSQL API module db.
3737The 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
3939if 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"],
You can’t perform that action at this time.
0 commit comments