You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
292 B
Python
15 lines
292 B
Python
2 years ago
|
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()
|