Skip to main content

⚰ col-reaper

Find dead columns in your data warehouse. Drop what nobody uses.

CI PyPI Python 3.9+ License: MIT

col-reaper scans your Snowflake or BigQuery query history and finds columns that nobody has queried recently. It outputs a report and a ready-to-run SQL migration script so your team can safely clean up the schema.

Zero data leaves your warehouse. col-reaper is strictly read-only and only reads column metadata and query text — never your actual data.


Why col-reaper?

Over time, data warehouses accumulate ghost columns — columns created for a one-off analysis, a deprecated feature, or a migration that never finished. These columns:

  • Cost money — cloud warehouses charge for storage and scan bytes
  • Slow down queries — wider tables = more bytes scanned per full scan
  • Confuse analysts — "is referral_source_v1 or referral_source_v2 correct?"
  • Hide in plain sight — no warehouse has a built-in "who uses this column?" view

col-reaper fills that gap.


Try it in 30 seconds (no credentials needed)

pip install col-reaper

# Run the demo — synthetic e-commerce data, no warehouse required
col-reaper demo

# See it as HTML
col-reaper demo --format html --output demo.html && open demo.html

# See the migration SQL
col-reaper demo --format sql

Installation

# Base install (demo mode + all analysis, no warehouse drivers)
pip install col-reaper

# With Snowflake support
pip install "col-reaper[snowflake]"

# With BigQuery support
pip install "col-reaper[bigquery]"

# Everything
pip install "col-reaper[all]"

Quick start

Snowflake

export SNOWFLAKE_ACCOUNT=xy12345.us-east-1
export SNOWFLAKE_USER=col_reaper_svc
export SNOWFLAKE_PASSWORD=...
export SNOWFLAKE_DATABASE=ANALYTICS
export SNOWFLAKE_WAREHOUSE=COMPUTE_WH

# Scan — terminal report
col-reaper scan --warehouse snowflake --days 90

# Scan with dry-run (review before committing to drops)
col-reaper scan --warehouse snowflake --days 90 --dry-run --format sql

# Generate migration SQL
col-reaper scan --warehouse snowflake --days 90 --format sql --output cleanup.sql

# Shareable HTML report
col-reaper scan --warehouse snowflake --days 90 --format html --output report.html

BigQuery

export GOOGLE_CLOUD_PROJECT=my-gcp-project
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json

col-reaper scan --warehouse bigquery --days 90

Output formats

terminal (default) — rich colour table

⚰  col-reaper  |  ANALYTICS  |  lookback: 90d  |  found: 7 dead columns

╭──────────┬────────────────┬─────────────────────┬─────────┬────────────┬────────────╮
│ Schema   │ Table          │ Column              │ Type    │  Last Seen │ Confidence │
├──────────┼────────────────┼─────────────────────┼─────────┼────────────┼────────────┤
│ PUBLIC   │ USERS          │ referral_source      │ VARCHAR │ never      │    high    │
│ PUBLIC   │ USERS          │ legacy_user_flag     │ BOOLEAN │ never      │    high    │
│ PUBLIC   │ ORDERS         │ shipping_v1_address  │ VARCHAR │ never      │    high    │
╰──────────┴────────────────┴─────────────────────┴─────────┴────────────┴────────────╯

sql — ready-to-run migration script

-- col-reaper migration script
-- Warehouse : ANALYTICS (snowflake)
-- Generated : 2026-11-01 09:30 UTC
-- Lookback  : 90 days
-- REVIEW CAREFULLY before running.

-- Table: ANALYTICS.PUBLIC.USERS
ALTER TABLE ANALYTICS.PUBLIC.USERS DROP COLUMN referral_source;
ALTER TABLE ANALYTICS.PUBLIC.USERS DROP COLUMN legacy_user_flag;

-- Table: ANALYTICS.PUBLIC.ORDERS
ALTER TABLE ANALYTICS.PUBLIC.ORDERS DROP COLUMN shipping_v1_address;

sql with --dry-run — deprecation comments (safe review mode)

-- col-reaper DRY RUN — deprecation comments only
-- Step 1: Paste these comments into your migration tool to mark columns.
-- Step 2: Monitor for 30 days. If no complaints, re-run without --dry-run.

-- Table: ANALYTICS.PUBLIC.USERS
-- [DEPRECATED 2026-11-01] ANALYTICS.PUBLIC.USERS.referral_source — not queried in 90 days (confidence: high). Review before dropping.
-- [DEPRECATED 2026-11-01] ANALYTICS.PUBLIC.USERS.legacy_user_flag — not queried in 90 days (confidence: high). Review before dropping.

json — machine-readable

{
  "meta": {
    "generated_at": "2026-11-01T09:30:00+00:00",
    "warehouse": "snowflake",
    "lookback_days": 90,
    "dead_column_count": 7,
    "dry_run": false
  },
  "dead_columns": [
    {
      "database": "ANALYTICS",
      "schema": "PUBLIC",
      "table": "USERS",
      "column": "referral_source",
      "data_type": "VARCHAR",
      "last_seen": null,
      "days_since_last_use": null,
      "confidence": "high",
      "drop_statement": "ALTER TABLE ANALYTICS.PUBLIC.USERS DROP COLUMN referral_source;"
    }
  ]
}

html — shareable report with filtering and sorting

col-reaper scan --warehouse snowflake --format html --output report.html
# Open report.html in any browser — no server needed, fully self-contained

The HTML report includes:

  • Summary stats (dead count, confidence breakdown)
  • Filterable, sortable table
  • One-click copy of the DROP statement per column
  • Dark theme, works offline

markdown — paste into GitHub / Slack / Notion

col-reaper scan --warehouse snowflake --format markdown

Dry-run mode

Always run with --dry-run first.

Dry-run mode outputs review comments instead of DROP statements. Use it to:

  1. Share the list with your team for review
  2. Watch for complaints for 30 days (BI tools, notebooks, apps)
  3. Only then run the real migration
# Step 1: Review
col-reaper scan --warehouse snowflake --days 90 --dry-run --format sql --output review.sql

# Step 2 (after 30+ days): Actually drop
col-reaper scan --warehouse snowflake --days 90 --format sql --output cleanup.sql

Filtering

# Skip entire schemas
col-reaper scan --warehouse snowflake --exclude-schema STAGING --exclude-schema RAW

# Skip specific tables
col-reaper scan --warehouse snowflake --exclude-table TEMP_MIGRATION

# Skip columns matching a pattern (substring, case-insensitive)
col-reaper scan --warehouse snowflake --exclude-column _deprecated --exclude-column legacy_

# Combine filters
col-reaper scan --warehouse snowflake \
  --exclude-schema STAGING \
  --exclude-column _v1 \
  --days 60

CI/CD integration

Add col-reaper to your CI pipeline to enforce a maximum number of dead columns:

# .github/workflows/warehouse-hygiene.yml
name: Warehouse hygiene check
on:
  schedule:
    - cron: '0 9 * * 1'   # every Monday at 9am UTC
  workflow_dispatch:

jobs:
  col-reaper:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install col-reaper
        run: pip install "col-reaper[snowflake]"

      - name: Scan for dead columns
        env:
          SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
          SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
          SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
          SNOWFLAKE_DATABASE: ANALYTICS
          SNOWFLAKE_WAREHOUSE: COMPUTE_WH
        run: |
          col-reaper scan \
            --warehouse snowflake \
            --days 90 \
            --exclude-schema STAGING \
            --format markdown \
            --output dead-columns.md

      - name: Upload report
        uses: actions/upload-artifact@v4
        with:
          name: dead-columns-report
          path: dead-columns.md

      # Optional: fail the build if dead columns are found
      # - name: Fail if dead columns exist
      #   run: col-reaper scan --warehouse snowflake --days 90 --fail-on-found

How it works

  1. Fetch schema — col-reaper reads INFORMATION_SCHEMA.COLUMNS to get every column in scope (read-only, metadata only).

  2. Fetch query history — it reads recent SELECT queries from:

    • Snowflake: SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY (365-day history, requires IMPORTED PRIVILEGES on SNOWFLAKE DB) — falls back to INFORMATION_SCHEMA.QUERY_HISTORY (7-day history, no special grants needed)
    • BigQuery: region-us.INFORMATION_SCHEMA.JOBS_BY_PROJECT
  3. Parse SQL — each query's text is parsed with sqlglot to extract every column reference. A regex fallback handles edge cases.

  4. Dead = not referenced — a column is "dead" if it appears in zero parsed queries. A confidence score (high/medium/low) accounts for ambiguous short names.

  5. Report — results are rendered in your chosen format with optional DROP statements.


Confidence scores

Score Meaning Example column names
high Specific name, low false-positive risk shipping_v1_address, fb_pixel_id_deprecated
medium Short name (≤ 3 chars), slightly ambiguous qty, sku, ref
low Very common name — might match unrelated queries id, name, created_at

Recommendation: review "low" confidence columns manually before dropping.


Security

col-reaper is strictly read-only. It never writes anything to your warehouse.

See SECURITY.md for:

  • Exact minimum-permission SQL scripts for Snowflake and BigQuery
  • Network traffic audit instructions
  • Complete list of what col-reaper reads and what it never reads

Supported warehouses

Warehouse Status Query history source History depth
Snowflake ✅ Stable ACCOUNT_USAGE.QUERY_HISTORY (or INFORMATION_SCHEMA fallback) 365 days (7 fallback)
BigQuery ✅ Stable INFORMATION_SCHEMA.JOBS_BY_PROJECT 180 days
Redshift 🔜 Planned STL_QUERY 7 days
Databricks 🔜 Planned system.access.audit 365 days
DuckDB 🔜 Planned — —

Contributing

See CONTRIBUTING.md — it includes a step-by-step guide for adding a new warehouse connector.


License

MIT © 2026 Sanjay Kandimalla

Metadata

Release files for col-reaper 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for col-reaper 0.3.0
File Size Uploaded Provenance Actions
col_reaper-0.3.0.tar.gz 98.8 kB Without provenance Details for col_reaper-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for col-reaper 0.3.0
File Interpreter ABI Platform Actions
col_reaper-0.3.0-py3-none-any.whl Python 3 none any Details for col_reaper-0.3.0-py3-none-any.whl

Total release size: 183.1 kB

Release files / col_reaper-0.3.0.tar.gz

Download URL col_reaper-0.3.0.tar.gz
Size 98.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0e96e91d70364d1dda2d02687e0f32d6b0335a44bdc780e4045ea8db456f44c1
BLAKE2b-256 checksum
How to use checksums
b38a3ef35b00a6196383aeb5a00a45e65a8738f269083e91179750f290c463c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / col_reaper-0.3.0-py3-none-any.whl

Download URL col_reaper-0.3.0-py3-none-any.whl
Size 84.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df260f66b154812d4c2509dd2910ab67083161e78edbd637aeea951614b60763
BLAKE2b-256 checksum
How to use checksums
a3e41e954469447ec949ec378a7a3f972df76d4d2d574b003aefb8d8f56e6e0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for col-reaper 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page