equal
deleted
inserted
replaced
95 class ConnectionInfo: |
95 class ConnectionInfo: |
96 |
96 |
97 def __init__(self, name, dsn, isolation_level=None, keep_alive=True, |
97 def __init__(self, name, dsn, isolation_level=None, keep_alive=True, |
98 init_statement=None, pool_size=1): |
98 init_statement=None, pool_size=1): |
99 self.name = name # connection name is logged with SQL queries |
99 self.name = name # connection name is logged with SQL queries |
100 self.dsn = dsn |
100 self.dsn = dsn # dsn or string with connection parameters |
101 self.isolation_level = isolation_level |
101 self.isolation_level = isolation_level |
102 self.keep_alive = keep_alive |
102 self.keep_alive = keep_alive |
103 self.init_statement = init_statement |
103 self.init_statement = init_statement |
104 self.pool_size = pool_size |
104 self.pool_size = pool_size |
105 |
105 |
228 pool_size -- how many connections will be kept open in pool |
228 pool_size -- how many connections will be kept open in pool |
229 (more connections will still be created but they will be closed by put_conn) |
229 (more connections will still be created but they will be closed by put_conn) |
230 None - disable pool, always return same connection |
230 None - disable pool, always return same connection |
231 isolation_level -- "autocommit", "read_committed", "serializable" or None for driver default |
231 isolation_level -- "autocommit", "read_committed", "serializable" or None for driver default |
232 keep_alive -- set socket to keepalive mode |
232 keep_alive -- set socket to keepalive mode |
233 dsn -- string with connection parameters (dsn means Data Source Name) |
233 dsn -- connection string (parameters or data source name) |
234 |
234 |
235 Alternative for dsn is keyword args (same names as in dsn). |
235 Other keyword args are used as connection parameters. |
236 |
236 |
237 ''' |
237 ''' |
238 if name in self.conn_known: |
238 if name in self.conn_known: |
239 raise PgManagerError('Connection name "%s" already registered.' % name) |
239 raise PgManagerError('Connection name "%s" already registered.' % name) |
240 |
240 |