-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateDatabase.py
More file actions
26 lines (18 loc) · 796 Bytes
/
CreateDatabase.py
File metadata and controls
26 lines (18 loc) · 796 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 mysql.connector
class CreateDatabase():
def __init__(self):
db = mysql.connector.connect(
host="localhost",
user="user",
password="password"
)
dbcursor = db.cursor()
# Master Log
dbcursor.execute("CREATE DATABASE Master_Log;")
dbcursor.execute("Use Master_Log;")
dbcursor.execute("CREATE TABLE logs (date DATETIME PRIMARY KEY, action_performed VARCHAR(3000), additional_details VARCHAR(3000), had_incident BOOLEAN, aircraft_number INT);")
# Incident log
dbcursor.execute("CREATE DATABASE Incident_Log;")
dbcursor.execute("Use Incident_Log;")
dbcursor.execute("CREATE TABLE logs(date datetime, code int, notes varchar(3000));")
c = CreateDatabase()