Listing 9: SQLite from Python.

import sqlite

conn = sqlite.connect(db="db", mode=077)
cursor = conn.cursor()
SQL = """select projectname_full as name,
         rating from project
         order by rating desc"""
cursor.execute(SQL)
row = cursor.fetchone()
while row != None:
   print "%14s, %15s" % (row['name'], row['rating'])
   row = cursor.fetchone()
conn.close()