-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.py
More file actions
29 lines (24 loc) · 781 Bytes
/
db.py
File metadata and controls
29 lines (24 loc) · 781 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 sqlite3
conn = sqlite3.connect("GestSchool.sqlite")
cursor = conn.cursor()
sql_school="""CREATE TABLE School(
id_school integer PRIMARY KEY,
name text NOT NULL,
date date ,
info text NOT NULL);"""
sql_photo="""CREATE TABLE Image(
id_photo integer PRIMARY KEY,
name text NOT NULL,
img text NOT NULL,
nametype text NOT NULL,
id_school integer ,
CONSTRAINT fk_school FOREIGN KEY (id_school) REFERENCES School(id_school) );"""
sql_virtual="""CREATE TABLE Virtual(
id_virtual integer PRIMARY KEY,
name text NOT NULL,
info text,
id_school integer,
CONSTRAINT fk_school FOREIGN KEY (id_school) REFERENCES School(id_school) );"""
cursor.execute(sql_school)
cursor.execute(sql_photo)
cursor.execute(sql_virtual)