2020-11-10 13:21:46 +00:00
|
|
|
from flask_marshmallow.sqla import SQLAlchemyAutoSchema
|
|
|
|
from marshmallow import EXCLUDE
|
|
|
|
from sqlalchemy import func
|
2020-11-13 14:58:21 +00:00
|
|
|
import marshmallow
|
|
|
|
from marshmallow import INCLUDE, fields
|
2020-11-10 13:21:46 +00:00
|
|
|
|
2020-11-13 14:58:21 +00:00
|
|
|
from crc import db, ma
|
2020-11-10 13:21:46 +00:00
|
|
|
|
|
|
|
class DataStoreModel(db.Model):
|
|
|
|
__tablename__ = 'data_store'
|
2020-11-11 16:36:25 +00:00
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
2020-11-13 17:03:29 +00:00
|
|
|
last_updated = db.Column(db.DateTime(timezone=True), default=func.now())
|
2020-11-17 14:33:29 +00:00
|
|
|
key = db.Column(db.String, nullable=False)
|
2020-11-10 13:21:46 +00:00
|
|
|
workflow_id = db.Column(db.Integer)
|
2020-11-17 14:33:29 +00:00
|
|
|
study_id = db.Column(db.Integer, nullable=True)
|
2020-11-10 13:21:46 +00:00
|
|
|
task_id = db.Column(db.String)
|
|
|
|
spec_id = db.Column(db.String)
|
2020-11-17 14:33:29 +00:00
|
|
|
user_id = db.Column(db.String, nullable=True)
|
2020-11-10 13:21:46 +00:00
|
|
|
value = db.Column(db.String)
|
2020-11-13 14:58:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DataStoreSchema(ma.Schema):
|
|
|
|
id = fields.Integer(required=False)
|
|
|
|
key = fields.String(required=True)
|
2020-11-13 17:03:29 +00:00
|
|
|
last_updated = fields.DateTime(server_default=func.now(), onupdate=func.now())
|
2020-11-13 14:58:21 +00:00
|
|
|
workflow_id = fields.Integer()
|
2020-11-17 14:33:29 +00:00
|
|
|
study_id = fields.Integer(allow_none=True)
|
2020-11-13 14:58:21 +00:00
|
|
|
task_id = fields.String()
|
|
|
|
spec_id = fields.String()
|
2020-11-17 14:33:29 +00:00
|
|
|
user_id = fields.String(allow_none=True)
|
2020-11-13 14:58:21 +00:00
|
|
|
value = fields.String()
|