Пример #1
0
def db():
    config = {'SQL_DATABASE_URI': 'sqlite://', 'SQL_ECHO': False}
    _db = SQLClient(config, model_class=Model)
    _db.create_all()

    yield _db

    _db.shutdown()
    _db.drop_all()
Пример #2
0
def filedb(tmpdir):
    dbpath = str(tmpdir.mkdir(random_alpha()).join('file.db'))
    config = {'SQL_DATABASE_URI': 'sqlite:///{0}'.format(dbpath)}

    _filedb = SQLClient(config, model_class=Model)
    _filedb.create_all()

    yield _filedb

    _filedb.shutdown()
    os.remove(dbpath)