-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathplayer_schema.py
More file actions
42 lines (35 loc) · 1.74 KB
/
player_schema.py
File metadata and controls
42 lines (35 loc) · 1.74 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
"""
SQLAlchemy ORM model for the Player database table.
Defines the schema and columns corresponding to football player attributes.
Used for async database CRUD operations in the application.
"""
from sqlalchemy import Column, String, Integer, Boolean
from databases.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)