24 lines
553 B
Python
24 lines
553 B
Python
import sqlite3
|
|
|
|
con = sqlite3.connect('repertoire.db')
|
|
cursor = con.cursor()
|
|
|
|
def execute_sql_from_file(filename, cursor):
|
|
with open(filename) as sqlfile:
|
|
sqlcommands = sqlfile.read()
|
|
list_of_commands = sqlcommands.split(';')
|
|
for command in list_of_commands:
|
|
cursor.execute(command)
|
|
|
|
|
|
execute_sql_from_file('repertoire.sql', cursor)
|
|
execute_sql_from_file('komponist_innen.sql', cursor)
|
|
execute_sql_from_file('Werk.sql', cursor)
|
|
execute_sql_from_file('Satz.sql', cursor)
|
|
|
|
con.commit()
|
|
|
|
# cursor.execute('COMMIT')
|
|
|
|
con.close()
|