class Job DeclarativeBase __tablename__ jobs id Column Integer primary

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
class Job(DeclarativeBase):
__tablename__ = 'jobs'
id = Column(Integer, primary_key=True)
name = Column(Unicode(255))
parent_id = Column(Integer, ForeignKey('jobs.id'), nullable=True)
subjobs = relation('Job', cascade='all', backref=backref('parent', remote_side='Job.id'))
def __init__(self, name):
self.name = name
def __repr__(self):
return 'job<%s>' % self.name