hub/persistence/models/Building.py

22 lines
746 B
Python

"""
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 db_config import Base
class Building(Base):
__tablename__ = "building"
id = Column(Integer, Sequence('building_id_seq'), primary_key=True)
city_id = Column(Integer, ForeignKey('models.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)