Skip to content

Commit 95a9290

Browse files
committed
Add --no-self-profile convenience option to postgres-to-sqlite
1 parent 086cdc7 commit 95a9290

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

database/src/bin/postgres-to-sqlite.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,11 @@ async fn main() -> anyhow::Result<()> {
473473
.use_delimiter(true)
474474
.help("Exclude given tables (as foreign key constraints allow)"),
475475
)
476+
.arg(
477+
clap::Arg::with_name("no-self-profile")
478+
.long("no-self-profile")
479+
.help("Exclude some potentially large self-profile tables (additive with --exclude-tables)"),
480+
)
476481
.arg(
477482
clap::Arg::with_name("since-weeks-ago")
478483
.long("since-weeks-ago")
@@ -505,11 +510,17 @@ async fn main() -> anyhow::Result<()> {
505510
let postgres = matches.value_of("postgres-db").unwrap();
506511
let sqlite = matches.value_of("sqlite-db").unwrap();
507512

508-
let exclude_tables: Vec<_> = matches
513+
let mut exclude_tables: std::collections::HashSet<_> = matches
509514
.values_of("exclude-tables")
510515
.unwrap_or_default()
511516
.collect();
512517

518+
if matches.is_present("no-self-profile") {
519+
exclude_tables.insert(SelfProfileQuerySeries.name());
520+
exclude_tables.insert(SelfProfileQuery.name());
521+
// `RawSelfProfile` is intentionally kept.
522+
}
523+
513524
let since_weeks_ago = match clap::value_t!(matches, "since-weeks-ago", u32) {
514525
Ok(weeks) => Some(weeks),
515526
Err(err) if err.kind == clap::ErrorKind::ArgumentNotFound => None,

0 commit comments

Comments
 (0)