예제 #1
0
파일: api.py 프로젝트: scroiset/climate
def drop_db():
    try:
        engine = db_session.get_engine(sqlite_fk=True)
        models.Lease.metadata.drop_all(engine)
    except Exception as e:
        LOG.error("Database shutdown exception: %s", e)
        return False
    return True
예제 #2
0
파일: api.py 프로젝트: scroiset/climate
def setup_db():
    try:
        engine = db_session.get_engine(sqlite_fk=True)
        models.Lease.metadata.create_all(engine)
    except sa.exc.OperationalError as e:
        LOG.error("Database registration exception: %s", e)
        return False
    return True
예제 #3
0
파일: api.py 프로젝트: scroiset/climate
def drop_db():
    try:
        engine = db_session.get_engine(sqlite_fk=True)
        models.Lease.metadata.drop_all(engine)
    except Exception as e:
        LOG.error("Database shutdown exception: %s", e)
        return False
    return True
예제 #4
0
파일: api.py 프로젝트: scroiset/climate
def setup_db():
    try:
        engine = db_session.get_engine(sqlite_fk=True)
        models.Lease.metadata.create_all(engine)
    except sa.exc.OperationalError as e:
        LOG.error("Database registration exception: %s", e)
        return False
    return True
예제 #5
0
파일: test.py 프로젝트: scroiset/climate
    def setUp(self):
        super(Database, self).setUp()

        fd = tempfile.NamedTemporaryFile(delete=False)
        self.db_path = fd.name
        database_connection = 'sqlite:///' + self.db_path
        cfg.CONF.set_override('connection', str(database_connection),
                              group='database')
        db_session.cleanup()
        self.engine = db_session.get_engine()

        db_api.setup_db()
        self.addCleanup(db_api.drop_db)
예제 #6
0
    def setUp(self):
        super(Database, self).setUp()

        fd = tempfile.NamedTemporaryFile(delete=False)
        self.db_path = fd.name
        database_connection = 'sqlite:///' + self.db_path
        cfg.CONF.set_override('connection',
                              str(database_connection),
                              group='database')
        db_session.cleanup()
        self.engine = db_session.get_engine()

        db_api.setup_db()
        self.addCleanup(db_api.drop_db)