import sqlite3 # create a connection to the database following the structure of schema.sql connection = sqlite3.connect('library.db') with open('schema.sql') as f: connection.executescript(f.read()) cur = connection.cursor() # close conenction connection.commit() connection.close()