22 lines
736 B
Python
22 lines
736 B
Python
|
"""
|
||
|
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
|
||
|
"""
|
||
|
|
||
|
from sqlalchemy import Column, Integer, String, Sequence, Float
|
||
|
from db_config import Base
|
||
|
from sqlalchemy.orm import relationship
|
||
|
|
||
|
|
||
|
class City(Base):
|
||
|
__tablename__ = "models"
|
||
|
id = Column(Integer, Sequence('city_id_seq'), primary_key=True)
|
||
|
name = Column(String, nullable=False)
|
||
|
location = Column(String, nullable=False)
|
||
|
country_code = Column(String, nullable=False)
|
||
|
latitude = Column(Float, nullable=False)
|
||
|
longitude = Column(Float, nullable=False)
|
||
|
building = relationship('Building', backref='models', lazy=True, cascade="all, delete-orphan")
|