1.4.16.4 Table Objects

Table objects can be accessed through the tables attribute of the Connection object like this:

>>> print connection.tables['tableName'].name
tableName
>>> print connection.tables['tableName']['columnName'].name
columnName

class Table

Table objects store all the meta data there is to know about an SQL table. They are created by the web.database module and should not be created manually. They are simply structures to hold table information. The values should not be changed.

Table objects have the following attributes:

name
The name of the table correctly capitalised
columns
A list of Column objects describing each column of the table
primaryKey
The name of the primary key column of the table or None if no primary key is specified
parentTables
A list of the names of any tables for which the table has foreign key fields
childTables
A list of the names of any tables for which the table is a parent table

and the following methods:

has_key( columnName)
columnExists( columnName)
Returns True if columnName is the name of a column in the table
column( columnName)
__getitem__( columnName)
Returns the column object for columnName

Table objects can also contain any other useful methods which the module implementer feels are appropriate.