def test_import_db_dump(self): id1 = dump._create_new_inc_dump_record()[0] path = dump.dump_db(self.temp_dir) self.reset_db() dump.import_db_dump(path, _TABLES) self.assertEqual(dump.list_incremental_dumps()[0][0], id1) id2 = dump._create_new_inc_dump_record()[0] self.assertGreater(id2, id1)
def full_db(location, threads, rotate): print("Creating full database dump...") path = dump.dump_db(location, threads) print("Done! Created:", path) if rotate: print("Removing old dumps (except two latest)...") remove_old_archives(location, "acousticbrainz-dump-[0-9]+-[0-9]+.tar.xz", is_dir=False, sort_key=lambda x: os.path.getmtime(x))
def full_db(location, threads, rotate): db.init_db_engine(config.SQLALCHEMY_DATABASE_URI) print("Creating full database dump...") path = dump.dump_db(location, threads) print("Done! Created:", path) if rotate: print("Removing old dumps (except two latest)...") remove_old_archives(location, "acousticbrainz-dump-[0-9]+-[0-9]+.tar.xz", is_dir=False, sort_key=lambda x: os.path.getmtime(x))
def full_db(location, threads, rotate): current_app.logger.info("Creating full database dump...") path = dump.dump_db(location, threads) current_app.logger.info("Done! Created:", path) if rotate: current_app.logger.info("Removing old dumps (except two latest)...") remove_old_archives(location, "acousticbrainz-dump-[0-9]+-[0-9]+.tar.xz", is_dir=False, sort_key=lambda x: os.path.getmtime(x))
def full_db(location, threads, rotate): # inits the db engine create_app() print("Creating full database dump...") path = dump.dump_db(location, threads) print("Done! Created:", path) if rotate: print("Removing old dumps (except two latest)...") remove_old_archives(location, "acousticbrainz-dump-[0-9]+-[0-9]+.tar.xz", is_dir=False, sort_key=lambda x: os.path.getmtime(x))
def _incremental_db(location, id, threads): print("Creating incremental database dump...") path = dump.dump_db(location, threads, incremental=True, dump_id=id) print("Done! Created: %s\n" % path)
def _incremental_db(location, id, threads): current_app.logger.info("Creating incremental database dump...") path = dump.dump_db(location, threads, incremental=True, dump_id=id) current_app.logger.info("Done! Created: %s\n" % path)
def test_import_db_dump(self): path = dump.dump_db(self.temp_dir) self.reset_db() dump.import_db_dump(path)
def test_dump_db(self): path = dump.dump_db(self.temp_dir) self.assertTrue(os.path.isfile(path))