Create Weather Model + Update requirements.txt

This commit is contained in:
shadowik 2024-10-15 01:42:02 +04:00
parent e0d114346a
commit 1e6783b476
2 changed files with 31 additions and 1 deletions

View File

@ -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]

View File

@ -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