The Database object is used primarily as a container for Table objects. The function reference is shown below:
name is an arbitrary name for the database used by the
repr() funcitons. If not specified name is set to the class name for the database.
web.databasecursor specified bt cursor. Once the database is initialised you can't add or change the table definitions.
Truedon't raise an Exception if the table doesn't already exist.
Trueif all the tables exist,
web.database.object.Tableobjects for each of the tables in the database
(key, value)pairs where the key is the table name and the value is the
Truethen each table object in the dictionary if also made into a dictionary of key:
Rowpairs. If rows is
Truethen each Row object of each table is made into a dictionary of column name : value pairs, except for single, multiple and related joins columns, since this could result in circular references.
Trueif the database has a table
0then no wrapping is done. Otherwise the table is wrapped to width characters. See the
web.util.table()documentation for more information.
Table objects can be obtained from a Database object by treating the Database object as a dictionary of Table objects referenced by their names.
For example, if a Database object named
database has tables named
Address you would access the
Person table with
database['Person'] and the
Address table with
>>> database['Person'] <web.database.object.Table 'Person'>
The Database object also provides a setup() method which can be used to setup fields if you want to create your own custom Database object.