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.
35 lines
976 B
Python
35 lines
976 B
Python
import sqlite3
|
|
|
|
from colorama import Cursor
|
|
|
|
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')
|
|
)
|
|
|
|
connection.commit()
|
|
connection.close() |