-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
32 lines (20 loc) · 1.1 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
__author__ = 'aleivag'
from sqlalchemy import Column, Integer, Unicode, PickleType, Enum, Boolean
from sqlalchemy.orm.session import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
class Model(object):
def __init__(self, engine):
self.Base = declarative_base(bind=engine)
self.metadata = self.Base.metadata
self.sessionmaker = sessionmaker(bind=engine)
class Work(self.Base):
__tablename__ = 'work'
id = Column(Integer, primary_key=True)
reschedule_event = Column(Enum('BEFORE_EVENT', 'AFTER_EVENT', 'ONE_TIME'), default='AFTER_EVENT', nullable=False)
data_point = Column(Enum('REAL_TIME'), default='REAL_TIME', nullable=False)
peridiocity = Column(Enum('5', '15', '30', '60', '90', '120', '300'), nullable=False)
test = Column(Unicode(80), nullable=False)
arguments = Column(PickleType, default={}, nullable=False)
enable = Column(Boolean, default=True, nullable=False)
session = Column(Unicode(45), default='', nullable=False)
self.Work = Work