perf: parquet based data export
This commit is contained in:
@@ -311,23 +311,35 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
|
||||
#[cfg(feature = "fetchall")]
|
||||
Commands::ListAllUserDump {} => {
|
||||
use crate::{cache::PLAYERS, utils::helpers::dump_cache};
|
||||
use crate::{
|
||||
cache::PLAYERS,
|
||||
utils::helpers::{dump_parquet, read_cache},
|
||||
};
|
||||
|
||||
dump_cache::<GetUserPreviewApiResp>("players.json", PLAYERS)?;
|
||||
}
|
||||
#[cfg(feature = "fetchall")]
|
||||
Commands::ScrapeAllB50Dump {} => {
|
||||
use crate::{cache::B50, utils::helpers::dump_cache};
|
||||
|
||||
dump_cache::<GetUserRatingApiResp>("b50.json", B50)?;
|
||||
let players: Vec<GetUserPreviewApiResp> = read_cache(PLAYERS)?;
|
||||
dump_parquet(players, "players.parquet")?;
|
||||
}
|
||||
#[cfg(feature = "fetchall")]
|
||||
Commands::ScrapeAllRegionDump {} => {
|
||||
use sdgb_api::title::model::GetUserRegionApiResp;
|
||||
use crate::{
|
||||
cache::REGIONS,
|
||||
utils::helpers::{dump_parquet, read_cache},
|
||||
};
|
||||
use sdgb_api::title::model::{GetUserRegionApiResp, UserRegionFlatten};
|
||||
|
||||
use crate::{cache::REGIONS, utils::helpers::dump_cache};
|
||||
let regions: Vec<GetUserRegionApiResp> = read_cache(REGIONS)?;
|
||||
let regions_flat = regions
|
||||
.into_iter()
|
||||
.map(Vec::<UserRegionFlatten>::from)
|
||||
.flatten()
|
||||
.collect::<Vec<_>>();
|
||||
dump_parquet(regions_flat, "regions.parquet")?;
|
||||
}
|
||||
#[cfg(feature = "fetchall")]
|
||||
Commands::ScrapeAllB50Dump {} => {
|
||||
use crate::{cache::B50, utils::helpers::dump_json};
|
||||
|
||||
dump_cache::<GetUserRegionApiResp>("region.json", REGIONS)?;
|
||||
dump_json::<GetUserRatingApiResp>("b50.json", B50)?;
|
||||
}
|
||||
|
||||
Commands::Userdata { user_id } => {
|
||||
|
||||
Reference in New Issue
Block a user