""" Lecture 27: SQLite Lab in Python Author: Mathieu Perreault Part 2 of the lab. """ import sqlite3, sys import random connection = sqlite3.connect(sys.argv[1]) cursor = connection.cursor() cursor.execute('DROP TABLE IF EXISTS polyphenopeptobismols') cursor.execute('CREATE TABLE polyphenopeptobismols (pepid INTEGER PRIMARY KEY, awesomeness INTEGER)') cursor.execute('SELECT pepid FROM Peptide') all = cursor.fetchall() for entry in all: pid = entry[0] rv = random.randint(0, 100) cursor.execute('INSERT INTO polyphenopeptobismols VALUES (?, ?)', (pid, rv)) connection.commit()