Skip to content

Getting started

See it in a minute

pip install dataranger
dataranger demo

The demo patrols a sample payments table with planted problems and writes a report you open in a browser. It runs locally in a few seconds, with no account or API key.

Installing DataRanger, running the demo, and opening a fixed incident in the report

For each incident the report shows every fix DataRanger tested on a copy and how far each one left the data from the source's control totals. Above, dividing one channel's amounts by 100 matches the source exactly, so that fix was applied; the same fix on every channel would have left a 99% gap. To run it on your own tables, see Try it.

Try it

Open in Colab

Run the demo notebook in your browser to see the summary, audit rows and interactive dashboard without installing anything locally.

pip install dataranger
dataranger demo                 # patrol a sample table with planted problems; opens as dataranger-demo/dashboard.html

On Windows, if dataranger is "not recognized" after installing, run it as python -m dataranger instead.

On your own DuckDB tables (a fact table partitioned by date, a reference table, and the source's control totals):

dataranger patrol --db warehouse.duckdb --table payments --ref-table customers \
    --manifest-table control_totals --key payment_id --reference customer_id \
    --date booking_date --segment channel --amount amount

Or point it straight at exported files, no database needed (.csv, .tsv or .parquet; the reader follows the extension):

dataranger patrol --facts-file payments.csv --ref-file customers.csv \
    --manifest-file control_totals.csv --key payment_id --reference customer_id \
    --date booking_date --segment channel --amount amount

Use one source at a time. With files, --table is optional and only sets the report title (it defaults to the facts file name). Add --days 45 to any source to patrol only the most recent days.

The control-totals table has one row per date and segment, plus a row with segment * for the whole day, with columns n (rows) and amount (sum). DataRanger never modifies your tables: fixed partitions go to fixed_version.csv, every decision and its evidence to audit.jsonl, a one-row-per-incident summary for spreadsheets to incidents.csv, and the morning report to dashboard.html.

If you don't keep a control-totals table yet, build it from the raw or landing table the facts are loaded from, with the same column flags:

dataranger totals --db warehouse.duckdb --table raw.payments --out-table ops.payments_totals \
    --date booking_date --segment channel --amount amount
dataranger totals --facts-file raw_payments.parquet --out control_totals.csv \
    --date booking_date --segment channel --amount amount

totals counts each day's rows (a timestamp counts toward its calendar day) and sums the amount, per segment and for the whole day. It stops if a row has no date, or has the segment value *. Rows with no segment count only toward the day's * row. Running it again replaces the output. --out-table is the only way DataRanger writes to your database: it writes only the table you name, replaces an existing table only if that table already has the control-totals columns, and never replaces the --table it reads from. The totals are only as independent as the table they come from, so build them upstream of the load you want to check.

For scheduled jobs, add --json to either patrol command to print one JSON object with incidents, auto_fixed, no_action, escalate, and the report path. Add --fail-on-escalate to return exit code 2 when any incident needs review, or 0 otherwise. The flags work independently: --fail-on-escalate also works with the normal text summary.

To hear about escalations without opening the report, add --notify-webhook URL (or set DATARANGER_WEBHOOK) with a Slack or Microsoft Teams incoming webhook. When at least one incident needs a person, the patrol posts {"text": ...} with the table, the counts and the partitions to look at (the same text as --summary-md). A Teams webhook made with the Workflows app (a logic.azure.com or powerplatform.com URL) gets the same text in an Adaptive Card instead, which is the shape it expects. A Discord webhook (discord.com) gets {"content": ...}, cut at a line break to Discord's 2,000 character limit with a closing line that says how many partitions were left out. --notify-always also posts when nothing needs a person. A failed post prints a note and leaves the exit code alone, and the webhook URL is never printed.

To run a daily patrol and download the morning report, copy the GitHub Actions example. It runs on demo data without credentials and includes instructions for your own tables.

The default threshold was calibrated on the DQ-Repair benchmark for a 1% target. Once people have reviewed some of DataRanger's decisions, calibrate on your own data:

dataranger calibrate --audit report/audit.jsonl --labels reviewed.csv --alpha 0.01

reviewed.csv has columns partition and verdict (right or wrong). About 300 reviewed incidents certify a 1% target and about 60 certify 5%.