-
Notifications
You must be signed in to change notification settings - Fork 3
/
create_db.py
29 lines (22 loc) · 981 Bytes
/
create_db.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
27
28
29
from connections import db
def create_db():
cur = db.cursor()
cur.execute("""CREATE TABLE scene_bounds (
video_date timestamp,
scene_id integer,
method text,
starts decimal,
ends decimal,
PRIMARY KEY(video_date, scene_id, method));
""")
cur.execute("""CREATE TABLE scenes (
video_date timestamp,
scene_id integer,
method text,
url text,
PRIMARY KEY(video_date, scene_id, method),
FOREIGN KEY(video_date, scene_id, method) references scene_bounds(video_date, scene_id, method));
""")
db.commit()
if __name__ == '__main__':
create_db()