description

Returns column (field) information for a statement that returns values, such as a SELECT or a SHOW. (read-only)

See also: MariaDB Connector/Python 1.0

DETAILS

This read-only attribute returns a tuple list describing the columns (fields) in the current result or None if no columnar result is active.

Each column's value is also a tuple, and contains the following information:

  • column name

  • type_code

  • display_size

  • internal_size

  • precision

  • scale

  • null_ok

EXAMPLES

import mariadb

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

cursor = conn.cursor()

cursor.execute("SELECT * FROM sample")

fields = [ x[0] for x in cursor.description ]