Skip to main content

logictrace

Trace a dbt column from a final mart back through your medallion layers and get a plain-English explanation of every transformation along the way.

Tracing: fct_revenue_monthly.revenue
────────────────────────────────────────────────────────────────────────────────

Step 1 · raw_transactions [source]
  Field origin: sale_price
  No transformations at this layer.

Step 2 · stg_transactions [staging]
  → Cast: sale_price → transaction_amount
  → Renamed: sale_price → transaction_amount
  ┌─ models/staging/stg_transactions.sql:3
  │  CAST(sale_price AS DOUBLE) AS transaction_amount

Step 3 · int_transactions_cleaned [intermediate]
  → Filtered: WHERE transaction_amount > 1000
  ┌─ models/intermediate/int_transactions_cleaned.sql:3
  │  transaction_amount

Step 4 · fct_revenue_monthly [marts]
  → Aggregated: transaction_amount → revenue
  → Renamed: transaction_amount → revenue
  ┌─ models/marts/fct_revenue_monthly.sql:3
  │  SUM(transaction_amount) AS revenue

────────────────────────────────────────────────────────────────────────────────

Summary
revenue is the monthly sum of sale_price (cast to DOUBLE) for transactions
above $1000. The filter is applied in int_transactions_cleaned before the
SUM aggregation occurs in the final mart.

Requirements

  • Python 3.11+
  • A dbt project with a compiled manifest.json (dbt compile or dbt run)
  • An Anthropic API key — get one from console.anthropic.com → API Keys

    Note: this is separate from the console login used by Claude Code. Even if you're already signed in to the Anthropic Console, you need to generate an API key explicitly.

Installation

git clone https://github.com/chridgn/logictrace
cd logictrace
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Setup

Save your Anthropic API key (one-time):

logictrace auth

Or set it as an environment variable:

export ANTHROPIC_API_KEY=sk-ant-...

Usage

Run from the root of your dbt project (where target/manifest.json lives):

logictrace trace --table fct_revenue_monthly --column revenue

Point to a manifest in a different location:

logictrace trace --table fct_revenue_monthly --column revenue --manifest ./target/manifest.json

Options

Flag Short Description
--table -t dbt model name to trace from
--column -c Column name to trace
--manifest -m Path to manifest.json (default: ./target/manifest.json)

How it works

  1. Reads manifest.json to build a column-level lineage graph
  2. Walks the dependency chain from the final model back to the source, following the column at each hop
  3. Classifies each transformation (CAST, RENAME, FILTER, AGGREGATE, EXPRESSION)
  4. Sends only the relevant SQL snippets to claude-haiku-4-5 - not full model SQL
  5. Streams a plain-English explanation of the full transformation chain

Development

pip install -e ".[dev]"
pytest

Metadata

Release files for logictrace 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 logictrace 0.1.0
File Size Uploaded
logictrace-0.1.0.tar.gz 8.9 kB Details

Built distribution (wheel)

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

Total release size: 19.3 kB

Release files / logictrace-0.1.0.tar.gz

Download URL logictrace-0.1.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6a4438084c34bba4d99835f0d3feaf61f22e7c8df384621cf994f0d5cfb60ae7
BLAKE2b-256 checksum
How to use checksums
1257307021b358d26e656363459531d3e9d8c87a79dcc8c2f859520b70ff48ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

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

Download URL logictrace-0.1.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0d318c4fc21beecf1ab6134a517ef28354ba7ba817d57f95a13deb92cd41100
BLAKE2b-256 checksum
How to use checksums
5c388d5dab2915c9a95d425aa50254b69086c8f5d7d85e9921fff288e1e0308f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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