def __init__(self, meta_list=None, abspath=None): """ Take a metalist and load sql templates from disk. Start the actual generating by calling batch() :meta_list: A list of MetaData Dictionaries """ if abspath is None: self.__connection = sqlite3.connect(get_dbpath()) else: self.__connection = sqlite3.connect(abspath) self.__cursor = self.__connection.cursor() self.__metalist = meta_list # We have to maintain a seperate lock for the db, # the db itself is locked from itself, but many separate # statements are not self.__db_lock = lock.FileLock(file_name='db', folder=get_archive_root(), timeout=100)
def remove(): """ Removes db """ dbpath = get_dbpath() os.remove(dbpath)