def upload_df(self, df: pd.DataFrame) -> None: if Term.objects.exists(): print('Terms data already uploaded') return print('Uploading terms...') with transaction.atomic(): terms_count = load_terms(df) print('Detected %d terms' % terms_count) print('Caching terms config for Locate tasks...') dict_data_cache.cache_term_stems()
def terms_loader(zip_file: ZipFile, files: list) -> None: if Term.objects.exists(): print('Terms data already uploaded') return print('Uploading terms...') df = load_csv_files(zip_file, files) with transaction.atomic(): terms_count = load_terms(df) print('Detected %d terms' % terms_count) print('Caching terms config for Locate tasks...') dict_data_cache.cache_term_stems()