Using sqlite with python
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
Setup
We support SQLite with the pysqlite
Python package. This is fully compatible with the sqlite3 included in python version 2.5.
Example application
Here is an example "script" that you can use to test your setup,
import sys
try:
from sqlite3 import dbapi2 as sqlite # python 2.5
except:
try:
from pysqlite2 import dbapi2 as sqlite
except:
print 'No sqlite library found'
sys.exit(1)
print "It worked!"
The above code will first check for the sqlite3 package and then the pysqlite2
package for maximum compatibility with any local python installs as the APIs are the same.
Mod python permissions
Please note: If you are using our python hosting package which uses mod_python you will
need to set the correct permissions on the SQLite database file. please refer to the
Mod_python Setup Information permissions section for more info.
|