HappyBase Connection Pool#
Google Cloud Bigtable HappyBase pool module.
Thread-safe connection pool.
All keyword arguments are passed unmodified to the
Connectionconstructor except for
autoconnect. This is because the
closedstatus of a connection is managed by the pool. In addition, if
instanceis not passed, the default / inferred instance is determined by the pool and then passed to each
Connectionthat is created.
Obtain a connection from the pool.
Must be used as a context manager, for example:
with pool.connection() as connection: pass # do something with the connection
timeoutis omitted, this method waits forever for a connection to become available from the local queue.
Yields an active
Connectionfrom the pool.
Parameters: timeout (int) – (Optional) Time (in seconds) to wait for a connection to open. Raises:
NoConnectionsAvailableif no connection can be retrieved from the pool before the
timeout(only if a timeout is specified).