System preparation

You need to install following packages to start coding with python and sqlite:
$ sudo apt-get install sqlite3 python2.4-pysqlite2 python2.4-sqlite python2.4-sqlobject

SQLite configuration

To create a new database type:
$ sqlite3 test.db

Execute following sql statement in the sqlite command shell:
sqlite> create table testtable (column1 varchar, column2 varchar);

Python example

#!/usr/bin/python
from pysqlite2 import dbapi2 as sqlite

con = sqlite.connect("test.db")
cu = con.cursor()
cu.execute("select * from testtable")

  • Share/Bookmark