get_connection()

Overview

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

See also: MariaDB Connector/Python 1.1 and in 1.0

EXAMPLES

import mariadb

pool = mariadb.ConnectionPool(
    pool_name = 'pool1',
    pool_size = 3,
    pool_reset_connection = False,
    host = '127.0.0.1',
    user = 'root',
    password = 'secret',
    database = 'test',
    )

conn = pool.get_connection()
cursor = conn.cursor()

CHANGE HISTORY

Release Series

History

1.1

  • Present starting in MariaDB Connector/Python 1.1.0rc1.

1.0

  • Present starting in MariaDB Connector/Python 1.0.0.