1.4.16.1 Module Interface

Access to the database is made available through connection objects. The web.database module provides the following constructor for these:

connect( adapter,[database,][user,][password,][host,][port,][socket,][**params])

Constructor for creating a connection to a database. Returns a Connection object. Not all databases will use all the parameters, but databases should use the parameters specified and not abbreviated versions. Any more complex parameters are passed directly to the driver's connect() method.

adapter
The type of database to connect to. Can currently be 'MySQL', 'PySQLite' or 'web.database ' but it is hoped that most database drivers will eventually be supported.
database
The database name to connect to.
user
The username to connect with.
password
The password to use.
prepend
A string to be transparantly used in front of all database tables.
host
The host to connect to if the database is running on a remote server.
port
The port to connect to if the database is running on a remote server.
socket
The socket to connect to if the database is running locally and requires a socket.
**params
Any other parameters to be passed to the driver

web.database implementers will usually override the method makeConnection() to provide this functionality as is clear from the source code.

These module globals are also be defined:

version
String constant stating the supported DB API level.

version_info
A tuple in the same format as sys.version_info for example something like (2,4,0,rc1,'beta')