get_connection()
Obtain a connection from the pool.
Usage
get_connection(
backend="postgresql",
host="localhost",
port=5432,
)If a pool for the given (backend, host, port) triple already exists, a connection is drawn from it. Otherwise a new pool is created with MIN_CONNECTIONS warm connections.
Parameters
backend: BackendName = "postgresql"-
Which database backend to connect to.
host: str = "localhost"-
The server hostname or IP address.
port: int = 5432-
The server port number.
Returns
Connection-
A ready-to-use connection.
Raises
ConnectionPoolExhausted-
If the pool has reached MAX_CONNECTIONS.
TimeoutError-
If a connection cannot be established within timeout seconds.