2270de96b18efd0bbcfe00b4966ecf1e5d9370dc
[yardstick.git] / api / database / models.py
1 ##############################################################################
2 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 from __future__ import absolute_import
10 from sqlalchemy import Column
11 from sqlalchemy import Integer
12 from sqlalchemy import String
13
14 from api.database import Base
15
16
17 class Tasks(Base):
18     __tablename__ = 'tasks'
19     id = Column(Integer, primary_key=True)
20     task_id = Column(String(30))
21     status = Column(Integer)
22     error = Column(String(120))
23     details = Column(String(120))
24
25     def __repr__(self):
26         return '<Task %r>' % Tasks.task_id
27
28
29 class AsyncTasks(Base):
30     __tablename__ = 'asynctasks'
31     id = Column(Integer, primary_key=True)
32     task_id = Column(String(30))
33     status = Column(Integer)
34     error = Column(String(120))
35
36     def __repr__(self):
37         return '<Task %r>' % AsyncTasks.task_id