-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
29 lines (25 loc) · 840 Bytes
/
Copy pathapp.py
File metadata and controls
29 lines (25 loc) · 840 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
26
27
28
29
import threading
import rest as rest
import sqlite3
if "__main__" == __name__:
import sqlite3
conn = sqlite3.connect('sqlite.db')
print ("Opened database successfully")
conn.execute('''
CREATE TABLE if not exists car (
car_id INTEGER PRIMARY KEY AUTOINCREMENT,
car_maker TEXT NOT NULL,
car_model TEXT NOT NULL,
car_year DATE NOT NULL);
''')
conn.execute('''
CREATE TABLE if not exists driver (
driver_id INTEGER PRIMARY KEY AUTOINCREMENT,
driver_firstName TEXT NOT NULL,
driver_lastName TEXT NOT NULL,
car_id INTEGER,
FOREIGN KEY(car_id) REFERENCES car(car_id) ON DELETE SET NULL);
''')
print("Table created successfully")
conn.close()
rest.run('localhost', 8181)