-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathplayer_schema.py
More file actions
39 lines (33 loc) · 1.71 KB
/
player_schema.py
File metadata and controls
39 lines (33 loc) · 1.71 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
# ------------------------------------------------------------------------------
# Schema
# ------------------------------------------------------------------------------
from sqlalchemy import Column, String, Integer, Boolean
from database.player_database import Base
class Player(Base):
"""
SQLAlchemy schema describing a database table of football players.
Attributes:
id (Integer): The primary key for the player record.
first_name (String): The first name of the player (not nullable).
middle_name (String): The middle name of the player.
last_name (String): The last name of the player (not nullable).
date_of_birth (String): The date of birth of the player.
squad_number (Integer): The squad number of the player (not nullable, unique).
position (String): The playing position of the player (not nullable).
abbr_position (String): The abbreviated form of the player's position.
team (String): The team to which the player belongs.
league (String): The league where the team plays.
starting11 (Boolean): Indicates if the player is in the starting 11.
"""
__tablename__ = "players"
id = Column(Integer, primary_key=True)
first_name = Column(String, name='firstName', nullable=False)
middle_name = Column(String, name='middleName')
last_name = Column(String, name='lastName', nullable=False)
date_of_birth = Column(String, name="dateOfBirth")
squad_number = Column(Integer, name='squadNumber', unique=True, nullable=False)
position = Column(String, nullable=False)
abbr_position = Column(String, name='abbrPosition')
team = Column(String)
league = Column(String)
starting11 = Column(Boolean)