Skip to content

feat(cli): add janitor --target and a --as preview - #898

Merged
kvlonge merged 1 commit into
mainfrom
feat/janitor-target-as
Oct 1, 2026
Merged

kvlonge merged 1 commit into
mainfrom
feat/janitor-target-as

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Why

sqb janitor had no --target and always cleaned the default target, unlike every other warehouse command. There was also no way to preview a target's cleanup through another connection before running it (CHI-463).

Changes

  • sqb janitor --target NAME: that target's connection, namespace, state and vars, the same as build --target.
  • sqb janitor --as NAME: preview, like plan --as. Compiles for NAME, inspects through the active target's connection, prints the plan, and changes nothing: no archives, drops, compatibility-view drops, audit or state writes, and no prompt. --as with --auto-approve is a usage error.
  • Plain janitor resolves its connection the same way build does, so dbt-profile connections now work in janitor.
  • The --as target check is shared by plan and janitor.
  • Docs and generated skill reference updated.

Verification

  • New DuckDB E2E file with two targets in separate schemas: --as lists only that target's cleanup with every table unchanged; --target ... --auto-approve cleans only its own schema; unknown targets and --as --auto-approve fail without changes.
  • Existing janitor and plan --as tests; make test; make check-ci; one independent review (no high or medium findings).

janitor --target NAME cleans up a configured target with that target's
connection, namespace and state, like build --target. janitor --as NAME
previews the janitor plan for another target's namespace through the
active target's connection without dropping, archiving, writing state or
prompting, reusing the plan --as target validation.
@kvlonge
kvlonge enabled auto-merge (squash) October 1, 2026 15:26
@kvlonge
kvlonge merged commit 9e7cff5 into main Oct 1, 2026
31 checks passed
@kvlonge
kvlonge deleted the feat/janitor-target-as branch October 1, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant