| 101 | |
| 102 | |
| 103 | class Report(Base): |
| 104 | __tablename__ = "_prefix__weather_reports" |
| 105 | |
| 106 | id: Mapped[int] = mapped_column(primary_key=True) |
| 107 | location_id: Mapped[int] = mapped_column( |
| 108 | ForeignKey("_prefix__weather_locations.id") |
| 109 | ) |
| 110 | temperature: Mapped[float] |
| 111 | report_time: Mapped[datetime.datetime] = mapped_column( |
| 112 | default=datetime.datetime.now |
| 113 | ) |
| 114 | |
| 115 | location: Mapped[WeatherLocation] = relationship(back_populates="reports") |
| 116 | |
| 117 | def __init__(self, temperature: float): |
| 118 | self.temperature = temperature |
| 119 | |
| 120 | |
| 121 | # define sharding functions. |
no test coverage detected