Is this how my createdb() method should look like? How would you write this method so it is both readable and correct? Thank you for your time and patience.
def createdb(self): try: con = sqlite3.connect(db) cur = con.cursor() cur.execute(''' CREATE TABLE t1 ( kid INTEGER PRIMARY KEY, c1 TEXT, c2 TEXT ) ''') cur.execute(''' CREATE TABLE t2 ( kid INTEGER PRIMARY KEY, c1 TEXT, c2 TEXT ) ''') cur.execute(''' CREATE TABLE t3 ( kid INTEGER PRIMARY KEY, c1 TEXT, c2 TEXT ) ''') con.commit() except: a = "ERROR: createdb did not commit. \n" b = "tried this sql: \n" raise IOError, "%s%s%s" % ( a, b, sql ) finally: cur.close() con.close() -- View this message in context: http://old.nabble.com/Python-db-programming-conventions-tp29977345p30273508.html Sent from the Python - db-sig mailing list archive at Nabble.com. _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig