-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_db.py
More file actions
executable file
·97 lines (74 loc) · 2.79 KB
/
create_db.py
File metadata and controls
executable file
·97 lines (74 loc) · 2.79 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/python3
import sqlite3
import argparse
parser = argparse.ArgumentParser(description="Create a SQLite DB file.")
parser.add_argument("output_file", help="Path to the output db file")
args = parser.parse_args()
output_file = args.output_file
# Connect to SQLite database (or create it if it doesn't exist)
conn = sqlite3.connect(output_file + '.db')
c = conn.cursor()
# Create a table to store rider information
c.execute('''CREATE TABLE IF NOT EXISTS riders (
id INTEGER PRIMARY KEY,
BC_number INTEGER,
race_number INTEGER,
firstname TEXT,
surname TEXT,
gender TEXT,
club_name TEXT,
race_category_current_year TEXT,
race_category_previous_year TEXT,
race_category_update TEXT,
average_position_last_year REAL,
total_points_last_year INTEGER,
average_points_last_year REAL,
races_finished_last_year INTEGER,
DOB TEXT,
YOB INTEGER,
IBX TEXT,
average_position REAL,
average_points REAL,
races_finished INTEGER,
total_points INTEGER,
best_X_points INTEGER,
r1_cat_position INTEGER,
r1_overall_position INTEGER,
r1_points INTEGER,
r2_cat_position INTEGER,
r2_overall_position INTEGER,
r2_points INTEGER,
r3_cat_position INTEGER,
r3_overall_position INTEGER,
r3_points INTEGER,
r4_cat_position INTEGER,
r4_overall_position INTEGER,
r4_points INTEGER,
r5_cat_position INTEGER,
r5_overall_position INTEGER,
r5_points INTEGER,
r6_cat_position INTEGER,
r6_overall_position INTEGER,
r6_points INTEGER,
r7_cat_position INTEGER,
r7_overall_position INTEGER,
r7_points INTEGER,
r8_cat_position INTEGER,
r8_overall_position INTEGER,
r8_points INTEGER,
r9_cat_position INTEGER,
r9_overall_position INTEGER,
r9_points INTEGER,
r10_cat_position INTEGER,
r10_overall_position INTEGER,
r10_points INTEGER,
r11_cat_position INTEGER,
r11_overall_position INTEGER,
r11_points INTEGER,
r12_cat_position INTEGER,
r12_overall_position INTEGER,
r12_points INTEGER
)''')
# Commit changes and close connection
conn.commit()
conn.close()