Home | Trees | Indices | Help |
---|
|
The db module is a DB API wrapper. It provides a DB API-compliant API that wraps real underlying DB API drivers, simplifying some non-portable operations like connect() and providing some new operations.
Some drivers come bundled with this package. Others can be added on the fly.
To get a list of all drivers currently registered with this module, use the get_driver_names() method:
import db for driver_name in db.get_driver_names(): print driver_name
Currently, this module provides the following bundled drivers:
Driver Name, as passed to get_driver() Database Underlying Python DB API module dummy None db.DummyDB gadfly Gadfly gadfly mysql MySQL MySQLdb oracle Oracle cx_Oracle postgresql PostgreSQL psycopg2 sqlserver SQL Server pymssql sqlite SQLite 3 sqlite3
To use a given driver, you must have the corresponding Python DB API module installed on your system.
It's possible to add a new driver to the list of drivers supplied by this module. To do so:
- The driver class must extend DBDriver and provide the appropriate methods. See examples in this module.
- The driver's module (or the calling program) must register the driver with this module by calling the add_driver() function.
The Binary(), Date(), DateFromTicks(), Time(), TimeFromTicks(), TimeStamp() and TimestampFromTicks() DB API functions can be found in the DB class. Thus, to make a string into a BLOB with this API, you use:
driver = db.get_driver(driver_name) db = driver.connect(...) blob = db.Binary(some_string)
|
|||
|
|
|||
Cursor Class for DB cursors returned by the DB.cursor() method. |
|||
DB The object returned by a call to DBDriver.connect(). |
|||
DBDriver Base class for all DB drivers. |
|||
DBError Base class for all DB exceptions. |
|||
Error Thrown to indicate an error in the db module. |
|||
Warning Thrown to indicate an error in the db module. |
|
|||
|
|||
list |
|
||
|
|||
DBDriver |
|
|
|||
drivers =
|
|||
apilevel =
|
|||
threadsafety =
|
|||
paramstyle = None hash(x) |
|||
__package__ =
|
|
|
Get the list of drivers currently registered with this API. The result is a list of DBDriver subclasses. Note that these are classes, not instances. Once way to use the resulting list is as follows: for driver in db.get_drivers(): print driver.__doc__
|
|
|
|
drivers
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Mar 14 15:21:05 2016 | http://epydoc.sourceforge.net |