import sqlite3 connection = sqlite3.connect('database.db') with open ('schema.sql') as f: connection.executescript(f.read()) cur = connection.cursor() cur.execute("INSERT INTO lists (title) VALUES (?)", ('Cooking',)) cur.execute("INSERT INTO lists (title) VALUES (?)", ('Birds',)) cur.execute("INSERT INTO lists (title) VALUES (?)", ('Homeworks',)) # list_id will start from 1 cur.execute("INSERT INTO items (list_id, content) VALUES (?, ?)", (1, 'zucchini or courgette?') ) cur.execute("INSERT INTO items (list_id, content) VALUES (?, ?)", (2, 'seen pigeon') ) cur.execute("INSERT INTO items (list_id, content) VALUES (?, ?)", (2, 'seen crawl') ) cur.execute("INSERT INTO items (list_id, content) VALUES (?, ?)", (2, 'seen airon') ) cur.execute("INSERT INTO items (list_id, content) VALUES (?, ?)", (3, 'Aiuto mo ci sono gli HAQPAKT') ) cur.execute("INSERT INTO assignees (name) VALUES (?)", ('Michael',)) cur.execute("INSERT INTO assignees (name) VALUES (?)", ('Manetta',)) cur.execute("INSERT INTO assignees (name) VALUES (?)", ('Joak',)) # assignmentsss cur.execute("INSERT INTO items_assignees (item_id, assignee_id) VALUES (?, ?)", (1,1)) cur.execute("INSERT INTO items_assignees (item_id, assignee_id) VALUES (?, ?)", (2,3)) cur.execute("INSERT INTO items_assignees (item_id, assignee_id) VALUES (?, ?)", (3,2)) connection.commit() connection.close()