Are there any interfaces to database packages in Python?
Python has a standard DB-API interface (see PEP
249), and compatible implementations are available for all widely
used database engines. See the
Database Topic Guide
Python 2.5 and later includes a DB-API compliant database package,
sqlite3, which uses an embedded SQL database,
>>> import sqlite3 as dbapi
>>> db = dbapi.connect("database.db")
>>> c = db.cursor()
>>> for record in c.execute("select * from table"):
... print record
For earlier versions, this database
can be downloaded separately (see http://pysqlite.org).
There’s also a standard bsddb package which provides an
interface to the BerkeleyDB library. Interfaces to disk-based hashes
such as dbm and gdbm are also included with
For bridging Python and databases more naturally, there are a variety of object-relational mapping tools, like SQLObject
IronPython can use all DotNet database connections, of course, and Jython
can use all Java database connections.