ANN: PySQLite 0.3.0 Released

Michael Owens
Fri, 6 Sep 2002 11:42:09 -0500

    pysqlite - Extension module for SQLite databases.

    A Python-DB API 2.0 compliant extension module that connects to
    SQLite databases.

    SQLite is a powerful, embedded relational database in a compact C 
    library. It supports a large subset of SQL92, multiple tables and indices,
    transactions, and triggers. It has a simple C/C++ interface requiring    
    only three functions to perform queries. It has ODBC, JDBC, Perl-DBI, PHP, 
    Tcl, Delphi, Ruby, DBExpress, wxWindows, Eiffel, and Lua bindings.

    Its source code is uncopyrighted and can be used for any purpose. More 
    information can be found at <>.

    import sqlite

    conn = sqlite.connect("db")
    cursor = conn.cursor()
    SQL = """ select category, family, genus, species
              from calflora order by genus, species limit 10"""


    for col in cursor.description:
            print "\t %12s - %3s bytes" % (col[0], repr(col[3]))

    row = cursor.fetchone()

    while row != None:
            print "%14s, %15s, %19s, %8s, %25s" % tuple(row)
            row = cursor.fetchone()

    SQL = "insert into calflora (family,genus,species) values(%s,%s,%s)"
    cursor.execute(SQL, ('greenus', 'weedus', 'maximus')) 



    Linux(source) and Windows (binary) downloads are available at 

    Gerhard Häring <>
    Michael Owens <>
    William Trenker <>


PySQLite has been tested on FreeBSD, Linux, and Windows with both Python 2.1 
and 2.2. The latest versions of SQLite (v. 2.6 and greater) are recommended. 

Version 0.3.0 fixed a lot of bugs, while also adding new features. Users of
PySQLite are recommended to upgrade.

The following are some of the changes and enhancements since the last 

- Squashed a few memory leaks.

- Exposed the sqlite_exec, sqlite_last_insert_rowid and
  sqlite_changes functions of SQLite to Python as methods of the
  connection object.

- Add support for Date types, if mxDateTime is

- Support for optional DB-API extensions from PEP 0249

- Added files for creating a PySQLite Debian package.

- - Added Cygwin as platform that's supported by default

- Added third example: program to dump a table in XML format.

- Use bool type and custom bool converter for boolean fields.

- Set cursor.rowcount appropriately after DML (insert/update/delete)

- Fixed a bug with the SQL-quoting of longs.

- Inline documentation improvement.

- Change invocation of ReferenceError to work with Python 2.1

- (really) implemented weak references from cursors to connections

- Added new test suite.

- Adapted test for threadsafety attribute.

- Added checks with user-defined float and string functions.

- Removed Connection.begin(). Transactions are now started
  implicitely.  - Use DB-API quoting instead of manual Python
  quoting.  - Use string methods instead of the string module.

- Added checks for functions/aggreagates that raise exceptions or
  return None (NULL).

- Added tests for proper commit/rollback behaviour. Added tests
  for autocommit feature.

- Implemented autocommit feature. Renamed the parameter of
  Connection.__init__ from "filename" to "db". Commit and rollback
  now check if the connection is open at all. Started adapting the
  weak reference code from pyPgSQL to loosely couple cursors and
  connections. This is needed when you want to check if there are
  any open cursors for a given connection, for example.

- Simplified version numbers, removed the check for equal version
  numbers in _sqlite and sqlite. This looked like overhead to
  me. The version number scheme is now only: major.minor.micro Set
  threadsafety to level 1. I believe we can guarantee than sharing
  the module among threads will do no harm. Sharing the connection