fetchall()

Overview

In 1.1:

Fetch all remaining rows of a query result, returning them as a sequence of sequences (e.g., a list of tuples). An exception will be raised if the previous call to execute() didn't produce a result set or execute() wasn't called before.

In 1.0:

Fetches all rows of a pending result set and returns a list of tuples.

See also: MariaDB Connector/Python 1.1 and in 1.0

EXAMPLES

import mariadb

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

cursor = conn.cursor()

cursor.execute("SELECT * FROM sample")
lst = cursor.fetchall()

# All values have been fetched and the cursor is ready for another request.

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.