-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_db.py
More file actions
25 lines (15 loc) · 846 Bytes
/
init_db.py
File metadata and controls
25 lines (15 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import sqlite3
connection = sqlite3.connect('database.db')
with open('schema.sql') as f:
connection.executescript(f.read())
cur = connection.cursor()
cur.execute("INSERT INTO templates (body) VALUES ('Hello, (personal). How are you today, (personal)?')")
cur.execute("INSERT INTO templates (body) VALUES ('Goodbye, (personal). Have a great day, (personal)!')")
cur.execute("INSERT INTO notifications (phone_number, personalization, template_id) VALUES (?, ?, ?)",
('+15208675309', 'Jenny', 1))
cur.execute("INSERT INTO notifications (phone_number, personalization, template_id) VALUES (?, ?, ?)",
('+12125554444', 'Linda', 2))
cur.execute("INSERT INTO notifications (phone_number, personalization, template_id) VALUES (?, ?, ?)",
('+12022051600', 'Joe', 1))
connection.commit()
connection.close()