hub/persistence/models/building.py

32 lines
1.2 KiB
Python
Raw Normal View History

"""
Model representation of a building
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Peter Yefi peteryefi@gmail.com
"""
from sqlalchemy import Column, Integer, String, Sequence, Float, ForeignKey
from sqlalchemy.dialects.postgresql import JSONB
from persistence.db_config import Base
class Building(Base):
"""A model representation of a building
Attributes:
city_id A reference to the city which has this building.
name The name of the building.
construction_year The year of construction of the building.
function The function (e.g. residential) of the building.
floor_area The computed area of the floor of the building.
data A JSON object which contain other data (like roof, walls, zones, etc) of the building
"""
__tablename__ = "building"
id = Column(Integer, Sequence('building_id_seq'), primary_key=True)
city_id = Column(Integer, ForeignKey('city.id'), nullable=False)
name = Column(String, nullable=False)
construction_year = Column(Integer, nullable=False)
function = Column(String, nullable=False)
floor_area = Column(Float, nullable=False)
data = Column(JSONB, nullable=False)