diff --git a/server/database.py b/server/database.py index 2776e93..861bddf 100644 --- a/server/database.py +++ b/server/database.py @@ -1,7 +1,9 @@ from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base -from sqlalchemy.orm import sessionmaker +from sqlalchemy.orm import sessionmaker, Mapped, mapped_column +from sqlalchemy.dialects.mysql import TIMESTAMP, TIME, VARCHAR +from datetime import datetime DATABASE_URL = "mysql+pymysql://wind:wind@193.124.203.110:3306/wind_towers" @@ -19,3 +21,30 @@ class User(Base): id = Column(Integer, primary_key=True, index=True) name = Column(String(50), index=True) + + +class Weather(Base): + __tablename__ = "weather" + + id: Mapped[int] = mapped_column(primary_key=True) + BarTrend: Mapped[str] = mapped_column(VARCHAR(255)) + CRC: Mapped[str] = mapped_column(VARCHAR(255)) + DateStamp: Mapped[datetime] = mapped_column(TIMESTAMP) + DewPoint: Mapped[float] + HeatIndex: Mapped[float] + ETDay: Mapped[float] + HumIn: Mapped[float] + HumOut: Mapped[float] + Pressure: Mapped[float] + RainDay: Mapped[float] + RainMonth: Mapped[float] + RainRate: Mapped[float] + RainStorm: Mapped[float] + RainYear: Mapped[float] + SunRise: Mapped[datetime] = mapped_column(TIME) + SunSet:Mapped[datetime] = mapped_column(TIME) + TempIn: Mapped[float] + TempOut: Mapped[float] + WindDir: Mapped[str] = mapped_column(VARCHAR(50)) + WindSpeed: Mapped[float] + WindSpeed10Min: Mapped[float] diff --git a/server/requirements.txt b/server/requirements.txt index 5d438d4..8986ff1 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -24,6 +24,7 @@ PyYAML==6.0.2 rich==13.8.1 shellingham==1.5.4 sniffio==1.3.1 +SQLAlchemy==2.0.35 starlette==0.38.6 typer==0.12.5 typing_extensions==4.12.2