Wednesday, October 25, 2006

Python 2.5 hello dataworld program

print "welcome to Jon's hello data world program"
import sqlite3
conn = sqlite3.connect(':memory:')
c = conn.cursor()
c.execute('''create table stocks
(date timestamp, trans varchar, symbol varchar,
qty decimal, price decimal)''')
c.execute("""insert into stocks
values ('2006-01-15', 'HELLO', 'DATAWORLD', 100, 35.14)""")
c.execute('select * from stocks order by price')
for row in c:
print row