-
Notifications
You must be signed in to change notification settings - Fork 0
/
createTables.py
executable file
·65 lines (51 loc) · 1.77 KB
/
createTables.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
execfile('/home/trey/CODE/mySqlite.py')
import os
dbpath = '/home/trey/CODE/investigate.db'
# Remove the db if it already exists
try:
os.remove(dbpath)
except:
pass
db = mySqlite(dbpath)
db.query('''CREATE TABLE datasets
(id INTEGER primary key,
path text,
year int);''')
db.query('''CREATE TABLE records
(id INTEGER primary key,
dataset_id REFERENCES datasets(id),
filename text);''')
db.query('''CREATE TABLE meta
(id INTEGER primary key,
dataset_id REFERENCES datasets(id),
software text,
instrument text,
datalogger text);''')
db.query('''CREATE TABLE fields
(id INTEGER primary key,
dataset_id REFERENCES datasets(id),
name text);''')
db.query('''CREATE TABLE projects
(id INTEGER primary key,
dataset_id REFERENCES datasets(id),
name text);''')
db.query('''CREATE TABLE reps
(id INTEGER primary key,
project_id REFERENCES projects(id),
name text,
location text,
locations text);''')
db.query('''CREATE TABLE dates
(id INTEGER primary key,
rep_id REFERENCES reps(id),
date text);''')
db.query('''CREATE TABLE odirs
(id INTEGER primary key,
dataset_id REFERENCES datasets(id),
name text);''')
db.query('''CREATE TABLE subdirs
(id INTEGER primary key,
dataset_id REFERENCES datasets(id),
name text);''')
db.commit()
db.close()