pgcom.connector.Connector¶
- class Connector(pool_size: int = 20, pre_ping: bool = False, max_reconnects: int = 3, **kwargs: str)[source]¶
Setting a connection with database.
Besides the basic connection parameters any other connection parameter supported by psycopg2.connect can be passed as a keyword.
- Parameters
pool_size – The maximum amount of connections the pool will support.
pre_ping – If True, the pool will emit a “ping” on the connection to test if the connection is alive. If not, the connection will be reconnected.
max_reconnects – The maximum amount of reconnects, defaults to 3.
Methods
Close all the connections handled by the pool.
Create a connection pool.
Generate a free connection from the pool.
ping
(conn)Ping the connection for liveness.
Close all the connections and create a new pool.