Skip to content

feat: dbts up --ttl 7d — auto-drop old sandboxes #11

Description

@luiul

Summary

Stamp a TTL into the sandbox's clone comment at dbts up time. A sweep step (either on every dbts up or as a separate dbts sweep command) drops sandboxes whose TTL has expired and that belong to the current user.

Why

Sandboxes accumulate. Forgotten zero-copy clones don't cost much in storage but they pollute the database list and obscure the active set. A self-managed TTL avoids the "who owns this clone?" archaeology.

Sketch

  • Extend the comment pattern: dbts: cloned from <src> at <ts> by <user> ttl=<7d>.
  • Update COMMENT_PATTERN in clone.py to capture the TTL group.
  • dbts up --ttl 7d (or --ttl 2025-12-01) writes the TTL.
  • Sweep policy: only drop databases owned by the current OS user (matched against the comment) — never drop someone else's sandbox.
  • Run sweep automatically on dbts up (cheap), or expose dbts sweep standalone.

Where it'd live

  • Extend src/dbts/clone.py (TTL parsing, sweep helper).
  • Wire --ttl flag into cmd_up.

Effort

Medium — needs the list command (#10) as a building block, plus careful "only drop your own" gating.

Tier

Tier 2 — lesser idea.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions