TUI for identifying and removing orphaned Snowflake objects not tracked in any dbt manifest
Project description
🧹 dbt-cleaner
Find and drop Snowflake objects that no dbt manifest claims.
A terminal UI for data engineers who need to keep Snowflake clean across multiple dbt projects. dbt-cleaner compares live database objects against one or more manifest.json files and gives you an interactive way to review and generate DROP statements — with zero risk of accidentally nuking something dbt still owns.
✨ Features
| 🔍 | Scans tables, views, materialized views, dynamic tables, external tables |
| 📦 | Supports multiple dbt projects targeting the same database |
| 🗄️ | Supports multiple target databases in a single session |
| 🔒 | Locked schemas — schemas with dbt objects are protected; only orphaned objects inside are listed |
| ⚙️ | Manual mode per schema — drop a whole schema or cherry-pick individual objects |
| 👁️ | Implicitly Dropped tab shows what CASCADE will remove before you commit |
| 📝 | Generates a ready-to-run .sql script with correct DROP statements per object type |
| 🔌 | Reads connections from ~/.snowflake/config.toml with env-var override support |
| 🧩 | Extensible connector protocol — adding Postgres or Databricks = one new file |
📦 Installation
pip install dbt-cleaner
Or with uv:
uv tool install dbt-cleaner
Requires Python 3.13+.
🚀 Usage
Interactive TUI
dbt-cleaner
Pre-fill fields from the command line:
dbt-cleaner \
--connection prod \
--database ANALYTICS \
--database REPORTING \
--manifest path/to/project_a/manifest.json \
--manifest path/to/project_b/manifest.json
CLI flags
| Flag | Short | Description |
|---|---|---|
--connection NAME |
-c |
Snowflake connection name from config.toml |
--database DB |
-d |
Target database (repeatable) |
--manifest PATH |
-m |
Path to manifest.json (repeatable) |
--include-schema SCHEMA |
Only scan these schemas (repeatable) | |
--exclude-schema SCHEMA |
Skip these schemas (repeatable) |
🖥️ Screen flow
Config screen ──► Analysis screen ──► Results screen ──► Preview screen
connections scans Snowflake review orphans SQL + save/print
databases parses manifests cycle schema state
manifests
Schema states (Results screen)
| Icon | State | Action |
|---|---|---|
| ○ | Not selected | No action |
| ✓ | Selected | DROP SCHEMA … CASCADE |
| ⚙ | Manual | Pick individual objects to drop |
| 🔒 | Locked | Schema has dbt models — protected |
Press Enter or Space to cycle state. Locked schemas cannot be changed.
🔑 Snowflake authentication
dbt-cleaner reads ~/.snowflake/config.toml:
[connections.prod]
account = "myorg-myaccount"
user = "deploy_user"
authenticator = "externalbrowser"
[connections.dev]
account = "myorg-myaccount"
authenticator = "PROGRAMMATIC_ACCESS_TOKEN"
token = "..."
Environment variable overrides follow the pattern SNOWFLAKE_CONNECTIONS_<NAME>_<PARAM>:
export SNOWFLAKE_CONNECTIONS_DEV_TOKEN="my-pat-token"
export SNOWFLAKE_CONNECTIONS_DEV_USER="deploy_user"
🧠 How orphan detection works
- Parses all supplied
manifest.jsonfiles —model,snapshot, andseednodes only (ephemeral models and sources are excluded) - Fetches all objects from target databases via
INFORMATION_SCHEMA - Compares on
(database, schema, identifier)— case-insensitive for unquoted identifiers - Classifies schemas:
- Orphan schema — zero dbt coverage → candidate for
DROP SCHEMA CASCADE - Locked schema — at least one dbt object → only un-tracked objects listed individually
- Orphan schema — zero dbt coverage → candidate for
📄 License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbt_cleaner-0.1.0.tar.gz.
File metadata
- Download URL: dbt_cleaner-0.1.0.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98cbc28c2fcb97f3e32db0be84f87e2afeb57f50ace63b85ac3e653e77c322be
|
|
| MD5 |
11cf53b08794b4f004e1d3ac63ece1b0
|
|
| BLAKE2b-256 |
dffd0277411d4ccdd663c90ef68ae1febab6429c498cb0ee9db09626652af74e
|
Provenance
The following attestation bundles were made for dbt_cleaner-0.1.0.tar.gz:
Publisher:
release.yml on crugroup/dbt-cleaner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_cleaner-0.1.0.tar.gz -
Subject digest:
98cbc28c2fcb97f3e32db0be84f87e2afeb57f50ace63b85ac3e653e77c322be - Sigstore transparency entry: 1857988075
- Sigstore integration time:
-
Permalink:
crugroup/dbt-cleaner@067b42c0d79589eb717515ff8c07620cc5dc5b3a -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/crugroup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@067b42c0d79589eb717515ff8c07620cc5dc5b3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file dbt_cleaner-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dbt_cleaner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d78f991cf4747d1410e843e6dda15a9d7cdc2a1724d89467db92942e49f74aac
|
|
| MD5 |
6483f292ba97b1fc36e8081cff1461b6
|
|
| BLAKE2b-256 |
166822bbf07080d3e9994f737f6408c2093eb4dca959264d0374006b015c4995
|
Provenance
The following attestation bundles were made for dbt_cleaner-0.1.0-py3-none-any.whl:
Publisher:
release.yml on crugroup/dbt-cleaner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dbt_cleaner-0.1.0-py3-none-any.whl -
Subject digest:
d78f991cf4747d1410e843e6dda15a9d7cdc2a1724d89467db92942e49f74aac - Sigstore transparency entry: 1857988080
- Sigstore integration time:
-
Permalink:
crugroup/dbt-cleaner@067b42c0d79589eb717515ff8c07620cc5dc5b3a -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/crugroup
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@067b42c0d79589eb717515ff8c07620cc5dc5b3a -
Trigger Event:
push
-
Statement type: