def upload_df(self, df: pd.DataFrame) -> None: if GeoEntity.objects.exists(): print('Geo config data already uploaded') return print('Uploading geo config...') with transaction.atomic(): geo_aliases_count, geo_entities_count = load_geo_entities(df) print('Total created: %d GeoAliases' % geo_aliases_count) print('Total created: %d GeoEntities' % geo_entities_count) print('Caching geo config for Locate tasks...') dict_data_cache.cache_geo_config()
def geoentities_loader(zip_file: ZipFile, files: list) -> None: if GeoEntity.objects.exists(): print('Geo config data already uploaded') return print('Uploading geo config ...') df = load_csv_files(zip_file, files) with transaction.atomic(): geo_aliases_count, geo_entities_count = load_geo_entities(df) print('Total created: %d GeoAliases' % geo_aliases_count) print('Total created: %d GeoEntities' % geo_entities_count) print('Caching geo config for Locate tasks...') dict_data_cache.cache_geo_config()