Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sqlalchemy.ext.declarative import declarative_base
- from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, types
- Base =declarative_base()
- # sql = """
- # CREATE TABLE IF NOT EXISTS `bikesharing` (
- # `tstamp` timestamp,
- # `cnt` integer,
- # `temperature` decimal(5, 2),
- # `temperature_feels` decimal(5, 2),
- # `humidity` decimal(4, 1),
- # `wind_speed` decimal(5,2),
- # `weather_code` integer,
- # `is_holiday` boolean,
- # `is_weekend` boolean,
- # `season` integer
- # );
- # """
- #trida bikesharing
- class BikeSharing(Base):
- __tablename__="bikesharing" # nazev tabulky
- # definujeme sloupce tabulky
- id = Column(Integer, primary_key=True, autoincrement=True)
- tstamp = Column(DateTime)
- cnt = Column(Integer)
- temperature = Column(types.DECIMAL(5, 2))
- humidity = Column(types.DECIMAL(4, 1))
- wind_speed = Column(types.DECIMAL(5, 2))
- weather_code = Column (Integer)
- is_holiday = Column(types.BOOLEAN)
- season = Column(Integer)
- # #
- # #trida Season
- class Season(Base):
- __tablename__ = "season"
- number=Column(Integer, ForeignKey(BikeSharing.season), primary_key=True, unique = True)
- season = Column(String(255))
- #
- # # #weather_code
- # class Weathercode(Base):
- # __tablename__ = "weathercode"
- # code=Column(Integer, ForeignKey(BikeSharing.weather_code), primary_key=True, unique = True)
- # weather = Column(String(255))
Advertisement
Add Comment
Please, Sign In to add comment