1.4.16.5 Column Objects

Column objects store all the information there is to know about a particular column. Column objects can be accessed through the connection.tables dictionary which contains all columns or through cursor.info which contains a tuple corresponding to the Column objects selected after a SELECT statement has been executed in portable mode (or None after any other SQL operation).

>>> cursor.select(columns=['columnName'], tables=['tableName'], execute=True)
>>> print cursor.info[0].name
columnName
>>> print cursor.info[0].table
tableName

class Column
name
The name of the column
type
The capitalised string representing the column type
baseType
The capitalised string representing the column type of the base type
table
The table of which the column is a part
required
Can be True or False depending on whether or not the column value is required (i.e. cannot be NULL)
unique
True if the field should be unique, False otherwise
key
True if the field is a primary key, False otherwise
default
The default value of the field
converter
A reference to the Converter object for the field type
position
The position of the field in the tuple returned by SELECT * FROM table