-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase.py
26 lines (24 loc) · 850 Bytes
/
database.py
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
26
import sqlite3
def save_email_to_db(email):
con = sqlite3.connect("rebelbean.db")
cur = con.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS emails (`email_id` INTEGER PRIMARY KEY, `email` varchar(255))""")
cur.execute("""INSERT INTO emails
('email')
VALUES
(?)""", (email,))
con.commit()
con.close()
print(f"email {email} saved to db!")
return True
def save_test_roast_availability(date, availability):
con = sqlite3.connect("rebelbean.db")
cur = con.cursor()
cur.execute("""CREATE TABLE IF NOT EXISTS testroast (`date` datetime, `availability` varchar(255))""")
cur.execute("""INSERT INTO testroast
('date', 'status')
VALUES
(?, ?)""", date, availability)
con.commit()
con.close()
print(f"data saved to db!")