blob: 13f2988cf037235a53aefca66f7c63dbe8c896f9 (
plain)
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
|
__all__ = ["Job"]
import enum
from sqlalchemy import Column, Integer, String, Enum
from sqlalchemy.orm import relationship
from ._base import Base, engine
from ._status import Status
class JobPriorities(enum.Enum):
high = 1
medium = 2
low = 3
class Job(Base):
__tablename__ = 'jobs'
id = Column(Integer, primary_key=True)
name = Column(String)
priority = Column(Enum(JobPriorities), default="medium")
status_updates = relationship("Status", back_populates="job")
def __repr__(self):
return "<Job(name='%s')>" % (self.name)
|