Read-only table diffs with segment attribution: which slice of your data changed.
This MCP server provides read-only table diffs with segment attribution, showing which slice of your data changed. It focuses on comparing tables and attributing differences to specific segments rather than enabling edits or write operations.
π οΈ Key Features
Read-only table diffs
Segment attribution for changed data slices
π Use Cases
Determine what changed between two table states
Attribute differences to specific segments of data
β οΈ Limitations
Read-only behavior (no table updates or writes)
β‘ Developer Benefits
Clear identification of changed segments when diffing tables
Consistent, comparison-focused workflow for tabular data
Diff two tables β see what changed, and which slice of your data it's concentrated in.
code
98.6% of modified rows have country = 'DE' (8.9Γ over-represented)
datadiffer compares two tables β dev vs. prod, PR vs. main, source vs.
destination β and tells you what changed and where it's concentrated: rows
added / removed / modified, per-column change rates, and segment attribution.
Built for the era when agents write your pipelines and someone has to check
their work. A maintained, MIT-licensed successor to the archived
data-diff.
Try it in 60 seconds
No credentials, no config, no account β it generates its own data:
That last block is the point. A diff tells you 432 rows changed; datadiffer
tells you they're almost all German orders β which is the difference between
"something moved" and "the VAT change landed."
Install
bash
pip install datadiffer # local files: Parquet, CSV, DuckDB
pip install 'datadiffer[snowflake]'# + Snowflake
pip install 'datadiffer[postgres]'# + Postgres
pip install 'datadiffer[mcp]'# + MCP server for AI agents
Use it
bash
# local files
datadiffer diff prod.parquet dev.parquet
# DuckDB
datadiffer diff prod.duckdb:orders dev.duckdb:orders
# Postgres (attached read-only)
datadiffer diff orders orders_v2 --source"postgresql://user@host:5432/db"# Snowflake, or anything in datadiffer.toml (run `datadiffer init` first)
datadiffer diff wh::analytics.orders wh::analytics_dev.orders
# cross-source: warehouse vs. a local file
datadiffer diff wh::orders orders_snapshot.parquet
# machine-readable, for scripts and CI
datadiffer diff a.parquet b.parquet --format json
Exit codes follow the GNU diff convention: 0 no differences, 1
differences found, 2 operational error.
Where it's concentrated: 98.6% of modified rows have country = 'DE' (8.87Γ over-represented)
93.2% of added rows have plan = NULL (63.19Γ over-represented)
yaml
-uses:gauthierpiarrette/datadiffer-action@v1with:config:datadiffer.toml# holds the warehouse connectiontable-a:wh::ANALYTICS.ORDERSschema-map:"ANALYTICS=ANALYTICS_PR_${PR_NUMBER}"max-changed-rows-pct:"0.5"env:SNOWFLAKE_PRIVATE_KEY:${{secrets.SNOWFLAKE_PRIVATE_KEY}}
Running dbt? docs/dbt-ci.md turns dbt ls --select state:modified into one diff per changed model, each with its own comment.
For AI agents (MCP)
Let a coding agent verify its own data changes:
bash
datadiffer init # scaffold datadiffer.toml, then add the server to your client
Any MCP client works β datadiffer init prints the server entry to paste,
including a uvx form for clients that prefer no global install.
Four read-only tools: list_connections, schema_diff, diff_summary
(cheap preflight), diff_tables (full report). Credentials never pass
through the model β tools take connection names from your local
datadiffer.toml, never DSNs. Over-cap requests come back as structured
refusals with a remedy, so the agent can self-correct instead of failing.
What makes it different
Most diff tools answer whether two tables match. datadiffer answers what
changed and where: which columns moved, and which slice of the data the
change is concentrated in.
Differences worth knowing: keys are inferred from declared constraints or
*_id conventions when you omit --key; unknown column names in filters are
an error, never silently ignored; and exit code 1 means "diff found"
(2 is reserved for operational errors), so CI can tell them apart.
Not yet ported: checksum-bisection hashdiff for very large cross-database
diffs β reladiff's headline capability β plus MySQL, Oracle, ClickHouse, Trino
and the rest of its connector list. If you need those today, use
reladiff; the bisection port is the top
item on our v0.2 roadmap and will credit its author.
Warehouses: Snowflake, Postgres, DuckDB, Parquet, CSV. BigQuery is next (v0.1.1).
Every diff runs in local DuckDB. Postgres is attached read-only and
scanned in place; Snowflake is pulled once over Arrow with only the needed
columns. Both are capped at 50M rows and 10 GiB per side β narrow with
--where. Pushing the comparison into the warehouse, and lifting that cap
with checksum bisection, are the next two pieces of work.
Postgres reads are unsnapshotted (the report says so in execution.snapshot);
Snowflake pulls are a single consistent SELECT.
Segment attribution is single-column, categorical, and descriptive β
"over-represented", never causal.
Project
MIT, no CLA, no telemetry. The report schema
is frozen at v1 and contract-tested, so pipelines and agents that parse it keep
working across releases. Dependencies are deliberately few: DuckDB, PyArrow,
sqlglot, click, rich.
What's next
BigQuery, then checksum-bisection hashdiff so large cross-database diffs stop
needing a row cap (ported with credit to reladiff), then more connectors.
Tracked in issues β
comment on the one you need and it moves up.
Contributing
bash
git clone https://github.com/gauthierpiarrette/datadiffer && cd datadiffer
uv sync --group dev
uv run pytest -q # warehouse tests skip unless credentials are set
uv run ruff check .
Prior art gratefully acknowledged: data-diff
and reladiff (Erez Shinan), whose
checksum-bisection design v0.2 will port; Adtributor (Microsoft Research) for
the attribution scoring; and DuckDB, which makes all of this fast enough to be
boring.
License
MIT
Install
Configuration
Environment variables
DATADIFFER_CONFIG
Path to datadiffer.toml holding named connections (run `datadiffer init` to scaffold one). Credentials never pass through tool arguments.