Skip to main content

icetrace

EXPLAIN ANALYZE for Apache Iceberg metadata — debug why your queries scan 100% of files without Spark, Trino, or Athena.

License: Apache-2.0 Python 3.11+ MCP Ready

icetrace is a strictly read-only, metadata-only scan-planning and pruning forensics engine for Apache Iceberg. Point it at any Iceberg table (AWS Glue, REST / Polaris / Lakekeeper / Nessie / S3 Tables, Hive, or SQL) from Cursor, Claude Code, or the CLI, and in seconds it simulates Iceberg's 4-stage pruning pipeline and proves exactly why files were not skipped:

  • 32-column metrics cutoff (MISSING_METRICS_COL_LIMIT) — Iceberg silently stops recording min/max bounds after column #32 by default.
  • 16-char string truncation collisions (TRUNCATED_BOUNDS) — default truncate(16) collapses prefixed IDs, tenant keys, or URIs across files, turning data skipping to 0%.
  • Destroyed clustering (OVERLAPPING_RANGES) — computes exact $O(N \log N)$ domain-weighted sweep-line interval overlap (0.00 = sorted, 1.00 = every file spans the full domain) to expose when binpack compaction or arrival-order writes broke pruning.
  • Zero-copy / writer stats omission (MISSING_METRICS_WRITER) — detects files registered via add_files or custom writers with missing Parquet footer statistics.
  • Manifest interleaving & evolved partition specs — catches Stage 1 manifest-list overlap, historical spec_id mismatches, and V2/V3 delete-file amplification.

Try It in 10 Seconds (Zero Credentials Required)

uvx icetrace demo

Creates a temporary local SQLite Iceberg table with 3 classic production pruning traps (truncate(16) prefix collision on tenant_id, 32-column metrics cutoff on col #35 trace_key, and unsorted amount vs sorted event_id) and runs explain + audit live:

╭───────────────────────────────────────────────────────────────────╮
│ icetrace explain  demo.events                                     │
│ Catalog: demo  |  Snapshot: 634953721215018604  |  Sampled: False │
│ Predicate: tenant_id = 'org_prod_us_east_03_0042'                 │
╰───────────────────────────────────────────────────────────────────╯
Stage 1 (Manifest List):   8 evaluated -> 0 pruned -> 8 surviving (0.0%)
Stage 2 (Partitions):      8 evaluated -> 0 pruned -> 8 surviving (0.0%)
Stage 3 (Column Bounds):   8 evaluated -> 0 pruned -> 8 surviving (0.0%)

Survival Attribution: TRUNCATED_BOUNDS: 8
HIGH [TRUNCATED_BOUNDS]: 8/8 surviving files matched a truncated prefix of length 16
  (metrics mode: truncate(16)) on column 'tenant_id'.
  Fix: ALTER TABLE ... SET TBLPROPERTIES ('write.metadata.metrics.column.tenant_id' = 'full')
       and run sort compaction on 'tenant_id'.
                          Per-Column Pruning Readiness
  #  Column      Mode          Bounds   Overlap   Trunc%  Grade  Issues
  1  event_id    truncate(16)    100%      0.00       0%    A    ok
  2  tenant_id   truncate(16)    100%      1.00     100%    F    TRUNCATED_BOUNDS; OVERLAPPING_RANGES
  3  amount      truncate(16)    100%      0.98       0%    F    OVERLAPPING_RANGES (0.98)
 35  trace_key   none              0%         -       0%    F    MISSING_METRICS_COL_LIMIT (35 > 32)

Why icetrace?

Tool Needs Cluster / Server? 4-Stage Predicate Pruning Simulation Per-File Root-Cause Attribution Sweep-Line Bounds Overlap Agent-Native MCP
Spark EXPLAIN / ScanReport Yes (Spark JVM) Post-execution counts only No No No
Nimtable / Amoro / Floe Yes (Docker/Postgres/JVM) No No No No
iceberg-meta / iceberg-doctor No No No (static thresholds) No Basic (2 tools)
Existing Iceberg MCP servers No No (catalog listing / SQL) No No Yes
icetrace No (zero-infra) Yes (100% PyIceberg parity) Yes (6 root causes) Yes ($O(N \log N)$) Yes (5 read-only tools + Skill)

Installation

uvx icetrace demo
uvx icetrace-mcp

2. Homebrew (macOS / Linux)

brew tap sanspareilsmyn/icetrace https://github.com/sanspareilsmyn/icetrace
brew install icetrace

3. uv tool / pip

# Core (REST, SQL/SQLite)
uv tool install icetrace

# With AWS Glue & S3 support
uv tool install "icetrace[glue]"

Agent-Native Setup (Cursor & Claude Code)

icetrace is designed to run directly inside your AI coding agent while your SQL queries, dbt models, Spark jobs, or table YAMLs are open.

Cursor (.cursor/mcp.json or ~/.cursor/mcp.json)

{
  "mcpServers": {
    "icetrace": {
      "command": "uvx",
      "args": ["--from", "icetrace[glue]", "icetrace-mcp"],
      "env": {
        "AWS_PROFILE": "${env:AWS_PROFILE}",
        "AWS_REGION": "us-east-1"
      }
    }
  }
}

Claude Code

claude mcp add --transport stdio --scope user icetrace -- uvx --from "icetrace[glue]" icetrace-mcp

Example Prompts

  • "Run explain_scan on prod.events for WHERE event_ts >= '2026-11-20' AND tenant_id = 'org_prod_8491'. Why did Athena scan 180 GB?"
  • "Audit prod.events and tell me which columns have broken pruning bounds or high overlap."
  • "Compare the last two snapshots of prod.events — did yesterday's compaction hurt clustering?"

Exposed MCP Tools (All readOnlyHint: true, destructiveHint: false)

  1. list_tables — Discover namespaces and Iceberg tables.
  2. explain_scan — 4-stage scan-planning simulator + per-file survival root-cause attribution.
  3. audit_pruning_health — Predicate-free per-column bounds coverage, truncation collision, sweep-line overlap ratio, and layout health.
  4. diff_snapshots — Snapshot-to-snapshot manifest growth, bounds coverage, clustering, and pruning regression diff.
  5. inspect_table_layout — Zero-manifest-read inspection of metadata.json (format version, column ordinals, evolved partition specs, sort order, properties).

A companion Agent Skill is bundled in skills/icetrace/SKILL.md.


CLI Usage

# Simulate 4-stage pruning for a SQL WHERE clause
icetrace explain prod.events --where "event_ts >= '2026-11-20' AND tenant_id = 'org_prod_01'"

# Audit all columns for bounds coverage, truncation traps, and overlap
icetrace audit prod.events

# Diff current snapshot vs parent (with optional predicate regression check)
icetrace diff prod.events --where "tenant_id = 'org_prod_01'"

# Inspect metadata.json only (zero manifest reads)
icetrace inspect prod.events

# JSON output for scripting / CI
icetrace audit prod.events --json

Catalog Configuration

icetrace reuses standard ~/.pyiceberg.yaml or environment variables:

  • ICETRACE_CATALOG_TYPE (glue, rest, sql, hive)
  • ICETRACE_CATALOG_URI, ICETRACE_WAREHOUSE, ICETRACE_TOKEN
  • Standard AWS credentials (AWS_PROFILE, AWS_REGION, IAM role / SSO) for Glue & S3.

Architecture & Security Guarantees

Cursor / Claude Code (MCP stdio)  |  CLI (icetrace)
                    v
      Evidence & Diagnosis Layer (Facts != Inferences)
                    v
   Core Forensics Engine (SQL AST -> 4-Stage Planner -> Sweep-Line Overlap -> Diff)
                    v
   PyIceberg Catalog Adapter (Glue, REST, SQL, Hive) — Metadata Only
  • Strictly Read-Only: icetrace never writes, compacts, expires, or mutates table metadata or data.
  • Metadata-Only: Only reads metadata.json, manifest list Avro, and manifest Avro files — never downloads Parquet/ORC data files.
  • Bounded Cost: Enforces max_manifests (default 200) so huge tables never silently hang or trigger unbounded S3 GETs.
  • Zero Telemetry: Your credentials and metadata never leave your machine.

Roadmap & Contributing

  • See ROADMAP.md for the 3-month release plan (v0.1 → v0.4) and 1–2 year vision.
  • See CHANGELOG.md for release notes.
  • See CONTRIBUTING.md to run the full test suite locally in < 2s with zero cloud credentials.

Licensed under the Apache License 2.0.

Metadata

Release files for icetrace 0.1.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 icetrace 0.1.0
File Size Uploaded Provenance Actions
icetrace-0.1.0.tar.gz 276.6 kB With provenance Details for icetrace-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for icetrace 0.1.0
File Interpreter ABI Platform Actions
icetrace-0.1.0-py3-none-any.whl Python 3 none any Details for icetrace-0.1.0-py3-none-any.whl

Total release size: 320.0 kB

Release files / icetrace-0.1.0.tar.gz

Download URL icetrace-0.1.0.tar.gz
Size 276.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fd2ea133f9dbe678099ac0069c72b51c78114c4e292c987ab5f03d7f3ab409cc
BLAKE2b-256 checksum
How to use checksums
353a755a6508396aed0169f1063e0ced8207f2a07dc87ab4e75f7e1a80904478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / icetrace-0.1.0-py3-none-any.whl

Download URL icetrace-0.1.0-py3-none-any.whl
Size 43.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36aec1b92f5fff4f15fdbdbb8f157c100b827c319facc74fc5d97421a5b8b32d
BLAKE2b-256 checksum
How to use checksums
1c10fd697f2620197e78265603a33608d731cd5463d3bb311e8be8470cfa3747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for icetrace 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for icetrace-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

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.

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