@@ -0,0 +1,1670 @@
+'''%0D%0ACreated on Jun 9, 2016%0D%0A%0D%0A@author: michael%0D%0A'''%0D%0Afrom datetime import datetime%0D%0Aimport sys%0D%0Aimport sqlite3%0D%0A%0D%0Adef main(dbname, tablename):%0D%0A    con = sqlite3.connect(dbname)%0D%0A    try:%0D%0A        cursor = con.cursor()%0D%0A        cursor.execute('select * from %25s' %25 (tablename))%0D%0A        print '%25s' %25 ('%5Ct'.join(x%5B0%5D for x in cursor.description))%0D%0A        count = 20%0D%0A        for row in cursor:%0D%0A            print '%25s' %25 ('%5Ct'.join(str(value) for value in row))%0D%0A            count -= 1%0D%0A            if 0 == count:%0D%0A                break%0D%0A    finally:%0D%0A        con.close()%0D%0A%0D%0Aif __name__ == '__main__':%0D%0A    if 1 == len(sys.argv):%0D%0A        print '%25s: start sqlite3 select' %25 (datetime.now())%0D%0A        con = sqlite3.connect('test.db')%0D%0A        try:%0D%0A            con.execute('drop table if exists test')%0D%0A            con.execute(%22create table test (first varchar(10), second int, third float, fourth date);%22)%0D%0A            inserts = %5B%0D%0A                ('one', 1, 1.1, '2016-01-01 12:12:12'), %5C%0D%0A                ('two', 2, 2.2, '2016-02-02 12:12:12'), %5C%0D%0A                ('three', 3, 3.3, '2016-03-03 12:12:12'), %5C%0D%0A                ('four', 4, 4.4, '2016-04-04 12:12:12') %5C%0D%0A            %5D%0D%0A            con.executemany(%22insert into test (first, second, third, fourth) values (?,?,?,?)%22, inserts)%0D%0A            con.commit()%0D%0A        finally:%0D%0A            con.close()%0D%0A        main('test.db', 'test')%0D%0A        print '%25s: completed sqlite3 select' %25 (datetime.now())%0D%0A    else:%0D%0A        print '%25s: start sqlite3 select for %25s:%25s' %25 (datetime.now(), sys.argv%5B1%5D, sys.argv%5B2%5D)%0D%0A        main(sys.argv%5B1%5D, sys.argv%5B2%5D)%0D%0A        print '%25s: completed sqlite3 select' %25 (datetime.now())%0D%0A

add test for reading sqlite3 tables