When called on a connection object, the connection will be closed down, including all connection-derived objects such as cursors. If close() is not called by the client, it will be implicitly called when the connection object is destroyed.

When called on a cursor, it closes out any pending or unread results, which allows the associated connection to be used for other operations via other cursors.

When called on a pool, it closes the pool and all its connections.

See also: MariaDB Connector/Python 1.0


import mariadb

conn = mariadb.connect(
    host = 'localhost',
    user = 'root',
    password = 'secret',

cursor = conn.cursor()

# ... do DB operations ...