API¶
-
class
dbpool.PooledConnection(*args, **kwargs)[source]¶ Inherit from
mysql.connector.MySQLConnection.Client should not create PooledConnection.
Just call
dbpool.ConnectionPool.borrow_connection().
-
class
dbpool.ConnectionPool(option: dbpool.impl.PoolOption, **kwargs)[source]¶ -
close()[source]¶ Close the
ConnectionPool. Free idle connections.
-
borrow_connection() → dbpool.impl.PooledConnection[source]¶ Borrow one connection from pool.
Returns: The available connection.
Return type: Raises: TestConnectionError– Test ping got error.CreateConnectionError– Create new connection failed.PoolError– When pool is closed.NoAvailableConnectionError– The pool is busy fully.
-