general_posts/python-weather-api/model/current.py

27 lines
692 B
Python

from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from .base import Base
class CurrentWeather(Base):
__tablename__ = 'current_weather'
DATE_FORMAT = "%Y-%m-%d"
id = Column(Integer, primary_key=True, autoincrement=True)
city = Column(String(100))
temperature = Column(Integer)
condition = Column(String(25))
humidity = Column(Integer)
wind_speed = (Column(Integer))
def to_dict(self):
return {
"city": self.city,
"temperature": self.temperature,
"condition": self.condition,
"humidity": self.humidity,
"wind_speed": self.wind_speed,
}