Search | Directories | Reference Tools
UW Home > UWIN > Computing and Networking > Software Guide 
-->
 
[Software Guide]
   
  UW Software Resources:
    Site Licenses 
 >   UW Tech Computers 
      A-Z Software List
      Computer List
      Software Category List
      Guidelines for Use
      Software Update Policy 
   
   
   
 

SQLite 3.5.7 and SQLite libraries

SQLite is a simple SQL database engine. According to the SQLite homepage it is:

"a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. It is used in countless desktop computer applications as well as consumer electronic devices including cellphones, PDAs, and MP3 players. The source code for SQLite is in the public domain".

In addition, sqlite libraries are callable from Python

Using the Software
Here is a useful tutorial on SQLite.

To use it on UW Technology computers you invoke the command "sqlite3". Here is a sample of a small program that creates a simple database and displays some information about it:
  % sqlite3 test.db     
SQLite version 3.5.7
Enter ".help" for instructions sqlite>sqlite> create table t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE); sqlite> insert into t1 (data,num) values ('This is sample data',3); sqlite> insert into t1 (data,num) values ('More sample data',6); sqlite> insert into t1 (data,num) values ('And a little more',9); sqlite> select * from t1; 1|This is sample data|3.0| 2|More sample data|6.0| 3|And a little more|9.0| sqlite>.quit
Here is an example of calling sqlite libraries from a simple python2.5 program named "test-sql.py":
  import sqlite3, sys
  dbname = 'test1.db'
  con = sqlite3.connect(dbname)
  cur = con.cursor()
  cur.execute('create table if not exists t (a, b, c)')
  ll = [{'a':1,'b':2,'c':3},{'a':4,'b':5,'c':6}]
  cur.executemany('insert into t (a, b, c) values (:a, :b, :c)', ll)
  con.commit()
  cur.execute('select * from t')

  print sys.version
  print 'contents of %s: ' % dbname
  print cur.fetchall()
and you invoke it as follows:
%python2.5 test-sql.py

Documentation
There is currently no "man page" for SQLite, but you can get help by typing ".help" after you invoke the command "sqlite3" with no arguments, e.g.

    $ sqlite3
    SQLite version 3.5.7
    Enter ".help" for instructions
    sqlite> .help

Technical Support
Help is available from UW Technology. Send a question to help@u.washington.edu if you need help with this software.