The ConnectionPool class

class ConnectionPool

MariaDB Connector/Python supports simple connection pooling. A connection pool holds a number of open connections and handles thread safety when providing connections to threads.

The size of a connection pool is configurable at creation time, but cannot be changed afterwards. The maximum size of a connection pool is limited to 64 connections.


Adds a connection object to the connection pool.

In case that pool doesn’t have a free slot or is not configured a PoolError exception will be raised.


Closes the pool and all connection inside the pool.

New in version 1.0.1.


Returns a connection from the connection pool or raises a PoolError if no connection is available.


Sets the connection configuration for the connection pool. For valid connection arguments see mariadb.connect() method.


This method doesn’t create connections in the pool. To fill the pool one has to use the add_connection() ḿethod.


Returns the maximum allowed size of the pool


Returns the size of connection pool


Returns the name of the pool.