Edgewall Software

Version 10 (modified by anonymous, 13 years ago) ( diff )

PySqlite

PySqlite is a Python binding for the SQLite light-weight database engine, which is Trac's default DatabaseBackend.

It should still be possible to use the old SQLite 2.8.x with the Pysqlite 1.0.1, but Trac 0.9 works best with SQLite 3.2.8. The compatible Python bindings are:

  • either the 1.x release branch of PySqlite
    • version 1.1.6 as of this writing,
    • version 1.1.7 required if using SQLite ≥ 3.3.3
  • or, better, the newer 2.0.x release branch
    • version ≥ 2.0.5 preferred,
    • 2.0.3 has been reported to cause crashes on Windows
    • version 2.0.7 required if using SQLite ≥ 3.3.3
  • the 2.1.3 version appears to work well with Trac. This release branch features a new statement cache and a better handling of concurrent write operations.

Recent versions are available from there.

Note: If you want to use Trac in a multi-threaded setup by using either TracModPython or TracStandalone, be sure to build a thread-safe version of SQLite, by using the --enable-threadsafe configuration switch. If you use a non thread-safe library, which is unfortunately what you get by default on non-windows platforms, you face the risk to get persistent database locks (see #2170).

Upgrading SQLite from 2.x to 3.x

The following information is copied from http://dev.ctor.org/pkcs1/wiki/TracUpgrade

The database formats used by SQLite 2.x and sqlite 3.x are incompatible. If you upgrade your SQLite version (this can also happen implicitly if you upgrade from PySQLite 1.0.x to 1.1.x or 2.x), then you must convert your database.

To do this, install both SQLite 2.8 and SQLite 3.x (they have different filenames so can coexist in the same directory). Then use the following commands (Windows):

 $ mv trac.db trac2.db
 $ sqlite trac2.db .dump | sqlite3 trac.db

Then when you're happy with the conversion and tested everything you can delete the trac2.db file.

Note: A similar procedure (sqlite3 corrupted.db .dump | sqlite3 recovered.db) can also be used to recover a corrupted database file (see #2598, for example).

For more information see http://www.sqlite.org/version3.html

Note: See TracWiki for help on using the wiki.