Friday, November 12, 2010

SQLite and Python

I created a table using SQLite, and then I wrote a simple function in python to list the data. I made a GUI button to execute the function too. It's not much, but it is a start.

Wednesday, November 10, 2010

Executing SQL commands in python


#database code for learning purposes
import sqlite3

connectdb=sqlite3.connect('mydata.db') #Create data base named mydata.db on disk
c=conn.cursor()                        #Create a cursor object so SQL commands can be executed

#Create a table named deedrecord
c.execute("create table deedrecord (deed text,grantor text,grantee text,deeddate text)")
#Add some records to the table
c.execute("insert into deedrecord values ('1234123','mickey mouse','donald duck','111010')")
c.execute("insert into deedrecord values ('3456345','steve atchison','ronald regan','110910')")

therows=c.execute("select * from deedrecord")

for rows in therows:
    print(rows[0])
    print(rows[1])
    print(rows[2])
    print(rows[3])


  
  

Followers

Blog Archive

About Me

My photo
Biking helps me to cope with life.