|
|
|
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()
|
|
|
|
|
|
|
|
cur.execute("INSERT INTO categories (category_name) VALUES (?)", ('Reading',))
|
|
|
|
cur.execute("INSERT INTO categories (category_name) VALUES (?)", ('Note',))
|
|
|
|
cur.execute("INSERT INTO categories (category_name) VALUES (?)", ('Question',))
|
|
|
|
|
|
|
|
cur.execute("INSERT INTO cards (category_id, content) VALUES (?,?)",
|
|
|
|
(1, 'Oltre Eboli'))
|
|
|
|
cur.execute("INSERT INTO cards (category_id, content) VALUES (?,?)",
|
|
|
|
(1, 'This is not an Atlas'))
|
|
|
|
cur.execute("INSERT INTO cards (category_id, content) VALUES (?,?)",
|
|
|
|
(2, 'This was the note'))
|
|
|
|
cur.execute("INSERT INTO cards (category_id, content) VALUES (?,?)",
|
|
|
|
(3, 'is this a question??'))
|
|
|
|
|
|
|
|
cur.execute("INSERT INTO topics (content) VALUES (?)", ('mapping process',))
|
|
|
|
cur.execute("INSERT INTO topics (content) VALUES (?)", ('Radical Neutrality',))
|
|
|
|
cur.execute("INSERT INTO topics (content) VALUES (?)", ('Honeycomb documentation',))
|
|
|
|
cur.execute("INSERT INTO topics (content) VALUES (?)", ('Metabolic Publishing',))
|
|
|
|
|
|
|
|
# Assign "mapping process" to "oltre eboli"
|
|
|
|
cur.execute("INSERT INTO topic_cards (topic_id, card_id) VALUES (?, ?)",
|
|
|
|
(1, 1))
|
|
|
|
cur.execute("INSERT INTO topic_cards (topic_id, card_id) VALUES (?, ?)",
|
|
|
|
(2, 1))
|
|
|
|
|
|
|
|
# close conenction
|
|
|
|
connection.commit()
|
|
|
|
connection.close()
|