2022-11-11 16:16:31 -05:00
|
|
|
"""
|
|
|
|
Model representation of a City
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Peter Yefi peteryefi@gmail.com
|
|
|
|
"""
|
|
|
|
|
2023-01-31 13:11:39 -05:00
|
|
|
import datetime
|
|
|
|
|
2023-01-10 12:26:08 -05:00
|
|
|
from sqlalchemy import Column, Integer, String, Sequence, ForeignKey
|
2023-01-31 13:11:39 -05:00
|
|
|
from sqlalchemy import DateTime, PickleType
|
2023-02-02 06:12:24 -05:00
|
|
|
from hub.persistence.configuration import Models
|
2023-01-31 13:11:39 -05:00
|
|
|
|
2022-11-11 16:16:31 -05:00
|
|
|
|
2023-02-02 06:12:24 -05:00
|
|
|
class City(Models):
|
2022-11-11 16:16:31 -05:00
|
|
|
"""A model representation of a city
|
|
|
|
"""
|
2023-02-02 06:12:24 -05:00
|
|
|
__tablename__ = 'city'
|
2022-11-11 16:16:31 -05:00
|
|
|
id = Column(Integer, Sequence('city_id_seq'), primary_key=True)
|
2023-02-13 05:17:25 -05:00
|
|
|
pickle_path = Column(String, nullable=False)
|
2022-11-11 16:16:31 -05:00
|
|
|
name = Column(String, nullable=False)
|
2023-01-31 13:11:39 -05:00
|
|
|
level_of_detail = Column(Integer, nullable=False)
|
|
|
|
climate_file = Column(String, nullable=False)
|
|
|
|
application_id = Column(Integer, ForeignKey('application.id'), nullable=False)
|
|
|
|
user_id = Column(Integer, ForeignKey('user.id'), nullable=True)
|
2022-11-11 16:16:31 -05:00
|
|
|
hub_release = Column(String, nullable=False)
|
2022-11-22 20:20:12 -05:00
|
|
|
created = Column(DateTime, default=datetime.datetime.utcnow)
|
2023-01-10 12:26:08 -05:00
|
|
|
updated = Column(DateTime, default=datetime.datetime.utcnow)
|
2022-11-11 16:16:31 -05:00
|
|
|
|
2023-02-13 05:17:25 -05:00
|
|
|
def __init__(self, pickle_path, name, level_of_detail, climate_file, application_id, user_id, hub_release):
|
|
|
|
self.pickle_path = str(pickle_path)
|
2022-11-25 18:21:09 -05:00
|
|
|
self.name = name
|
2023-01-31 13:11:39 -05:00
|
|
|
self.level_of_detail = level_of_detail
|
|
|
|
self.climate_file = climate_file
|
|
|
|
self.application_id = application_id
|
|
|
|
self.user_id = user_id
|
|
|
|
self.hub_release = hub_release
|