The Database object is used primarily as a container for Table objects. The function reference is shown below:
[,name=None]) |
name is an arbitrary name for the database used by the str() and repr() funcitons. If not specified name is set to the class name for the database.
| table) |
| cursor) |
web.database cursor specified bt cursor. Once the database is initialised you can't add or change the table definitions.
| ) |
| [ignoreErrors=False]) |
True don't raise an Exception if the table doesn't already exist.
| ) |
True if all the tables exist, False otherwise.
| name) |
| name) |
| ) |
| ) |
web.database.object.Table objects for each of the tables in the database
| ) |
(key, value) pairs where the key is the table name and the value is the web.database.object.Table object.
| [tables=False], [rows=False]) |
True then each table object in the dictionary if also made into a dictionary of key: Row pairs. If rows is True then 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.
| key) |
True if the database has a table table, False otherwise
| [width=80]) |
0 then no wrapping is done. Otherwise the table is wrapped to width characters. See the web.util.table() documentation for more information.
web.database cursor.
str() and repr() funcitons.
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 Person and Address you would access the Person table with database['Person'] and the Address table with database['Address'].
>>> 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.