Add API to get the status of async task
[yardstick.git] / api / database / __init__.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 import logging
10
11 from sqlalchemy import create_engine
12 from sqlalchemy.orm import scoped_session, sessionmaker
13 from sqlalchemy.ext.declarative import declarative_base
14
15 logger = logging.getLogger(__name__)
16 logger.setLevel(logging.DEBUG)
17
18 engine = create_engine('sqlite:////tmp/yardstick.db', convert_unicode=True)
19 db_session = scoped_session(sessionmaker(autocommit=False,
20                                          autoflush=False,
21                                          bind=engine))
22 Base = declarative_base()
23 Base.query = db_session.query_property()