api / models.py
tracinginsights's picture
Create models.py
842269e
from sqlalchemy import Column, Float, Integer, String
from sqlalchemy.ext.declarative import declarative_base
# from . import database
import database
class RacePace(database.Base):
__tablename__ = "race_pace"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
year = Column(Integer)
event = Column(String)
session = Column(String)
Driver = Column(String)
LapTime = Column(Float)
Diff = Column(Float)
Team = Column(String)
fill = Column(String)
class TopSpeed(database.Base):
__tablename__ = "top_speed"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
year = Column(Integer)
event = Column(String)
session = Column(String)
driver = Column(String)
top_speed = Column(Integer)
compound = Column(String)
team = Column(String)
fill = Column(String)
class Overtakes(database.Base):
__tablename__ = "overtakes"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
year = Column(Integer)
event = Column(String)
driver = Column(String)
overtakes = Column(Integer)
overtaken = Column(Integer)
class FastestLap(database.Base):
__tablename__ = "fastest_lap"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
year = Column(Integer)
event = Column(String)
session = Column(String)
driver = Column(String)
lap_time = Column(Float)
diff = Column(Float)
team = Column(String)
fill = Column(String)
class DriverStandings(database.Base):
__tablename__ = "driver_standings"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
year = Column(Integer)
driver = Column(String)
points = Column(Integer)
car = Column(String)
fill = Column(String)
class AvailableYears(database.Base):
__tablename__ = "available_years"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
year = Column(Integer)
class AvailableEvents(database.Base):
__tablename__ = "available_events"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
year = Column(Integer)
event = Column(String)
class AvailableSessions(database.Base):
__tablename__ = "available_sessions"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
year = Column(Integer)
event = Column(String)
session = Column(String)
class AvailableDrivers(database.Base):
__tablename__ = "available_drivers"
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
color = Column(String)
label = Column(String)
value = Column(String)