system_assignation/hub/persistence/models/simulation_results.py

33 lines
1.1 KiB
Python
Raw Normal View History

2023-01-31 13:11:39 -05:00
"""
Model representation of simulation results
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez Guillermo.GutierrezMorote@concordia.ca
"""
import datetime
2023-02-01 06:05:12 -05:00
from sqlalchemy import Column, Integer, String, Sequence, ForeignKey
2023-01-31 13:11:39 -05:00
from sqlalchemy import DateTime
from sqlalchemy.dialects.postgresql import JSONB
from hub.persistence.configuration import Models
2023-01-31 13:11:39 -05:00
class SimulationResults(Models):
2023-01-31 13:11:39 -05:00
"""
A model representation of an application
"""
__tablename__ = 'simulation_results'
2023-01-31 13:11:39 -05:00
id = Column(Integer, Sequence('application_id_seq'), primary_key=True)
city_id = Column(Integer, ForeignKey('city.id'), nullable=True)
city_object_id = Column(Integer, ForeignKey('city_object.id'), nullable=True)
name = Column(String, nullable=False)
values = Column(JSONB, nullable=False)
created = Column(DateTime, default=datetime.datetime.utcnow)
updated = Column(DateTime, default=datetime.datetime.utcnow)
def __init__(self, name, values, city_id=None, city_object_id=None):
self.name = name
self.values = values
self.city_id = city_id
self.city_object_id = city_object_id