-
Notifications
You must be signed in to change notification settings - Fork 1
/
example-quickstart.py
43 lines (31 loc) · 988 Bytes
/
example-quickstart.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
from sql_schema_builder.SQLSchemaBuilder import SQLSchemaBuilder
def _get_schema():
schema = {}
schema_version = 1.019
schema['teams'] = """
id_team I NOTNULL DEFAULT 0,
name C(32),
coach_name C(64),
points I,
matches_won I,
matches_drawn I,
matches_lost I,
timestamp_updated I8,
INDEX PRIMARY (id_team),
INDEX (timestamp_updated)
"""
schema['players'] = """
id_player I NOTNULL DEFAULT 0,
name C(64),
id_team I NOTNULL,
shirt_number I,
position ENUM('', 'goalkeeper', 'defender', 'midfielder', 'forward') DEFAULT '',
goals_scored I,
height I,
weight F,
INDEX PRIMARY (id_player),
INDEX (id_team, position, shirt_number)
"""
return schema, schema_version
db_schema = SQLSchemaBuilder(host='localhost', user='root', passwd='xxx', db='premierleague')
db_schema.UpdateSchema(*_get_schema())