DataRanger
v0.9.0Read-only data patrol for AI agents: find broken partitions, prove fixes, escalate the rest.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
patrol_duckdb
Check a fact table in a DuckDB database for data-quality incidents and say which are safe to fix. A patrol checks every daily partition of the fact table for duplicate keys, duplicate rows, missing partitions, rows that point to no reference record, null spikes, and row counts or amounts that do not match the source's control totals. For each problem it proposes a fix, tests that fix on a copy against the control totals, and decides: "auto-fixed" (proven and low risk), "no action needed" (checked, the data is right) or "escalate" (a person must decide). Use this before…
| Parameter | Type | Description |
|---|---|---|
db * | string | Path to the DuckDB database file. Opened read-only. |
manifest_table * | string | Table of the source system's control totals, one row per date and segment, with columns: the date column, the segment column ('*' = whole day), n (row count) and amount (sum). |
ref_table * | string | Reference table that fact rows point to, for example customers. |
table * | string | Fact table to check, optionally schema-qualified, for example gold.payments. |
amount | string | Numeric amount column in the fact table. It is compared with the 'amount' control total. |
category | Optional categorical column in the fact table. Omit if the table has none. | |
date | string | Date column the fact table is partitioned by, one partition per calendar day. The control totals must have a column with the same name. |
key | string | Column in the fact table that uniquely identifies a row (the primary key). |
lateness_days | integer | Give a day this many days of grace after it occurs before treating a shortfall against the control totals as broken, since it may still be waiting on late-arriving records (there is no load timestamp… |
out_dir | Folder to write the report files into. Created if missing; report files already there are overwritten. Omit to use a new temporary folder; its path comes back in outputs.folder. | |
playbook | Optional path to the team's playbook (.yml or .json) of restrictions, such as never fixing month-end days automatically. A restriction can only turn 'auto-fixed' into 'escalate', never the reverse. An… | |
ref_key | string | Column in the reference table that the fact table's reference column must match. |
reference | string | Column in the fact table that points to the reference table (the foreign key). |
runbooks_dir | Optional folder of the team's own fix procedures (.docx, .pdf, .md, .txt). When given, each incident that needs a person also lists the sections of those documents most likely to say how to resolve it… | |
segment | string | Column that splits each day into segments, for example channel or region. The control totals must have a column with the same name, where '*' means the whole day. |
threshold | Gate threshold: the largest relative gap to the control totals that a verified fix may leave and still be marked auto-fixed (0.01 = 1%). Lower is stricter. Omit for the benchmark-calibrated default, 0… |
patrol_files
Check a fact table in CSV, TSV or Parquet files for data-quality incidents and say which are safe to fix. A patrol checks every daily partition of the fact table for duplicate keys, duplicate rows, missing partitions, rows that point to no reference record, null spikes, and row counts or amounts that do not match the source's control totals. For each problem it proposes a fix, tests that fix on a copy against the control totals, and decides: "auto-fixed" (proven and low risk), "no action needed" (checked, the data is right) or "escalate" (a person must decide). Use thi…
| Parameter | Type | Description |
|---|---|---|
facts_file * | string | Path to the fact table as .csv, .tsv, .parquet or .pq. One row per event, partitioned by a date column. |
manifest_file * | string | Path to the source system's control totals as .csv, .tsv, .parquet or .pq: one row per date and segment, with the date column, the segment column ('*' = whole day), n (row count) and amount (sum). |
ref_file * | string | Path to the reference table that fact rows point to (for example customers), as .csv, .tsv, .parquet or .pq. |
amount | string | Numeric amount column in the fact table. It is compared with the 'amount' control total. |
category | Optional categorical column in the fact table. Omit if the table has none. | |
date | string | Date column the fact table is partitioned by, one partition per calendar day. The control totals must have a column with the same name. |
key | string | Column in the fact table that uniquely identifies a row (the primary key). |
lateness_days | integer | Give a day this many days of grace after it occurs before treating a shortfall against the control totals as broken, since it may still be waiting on late-arriving records (there is no load timestamp… |
out_dir | Folder to write the report files into. Created if missing; report files already there are overwritten. Omit to use a new temporary folder; its path comes back in outputs.folder. | |
playbook | Optional path to the team's playbook (.yml or .json) of restrictions, such as never fixing month-end days automatically. A restriction can only turn 'auto-fixed' into 'escalate', never the reverse. An… | |
ref_key | string | Column in the reference table that the fact table's reference column must match. |
reference | string | Column in the fact table that points to the reference table (the foreign key). |
runbooks_dir | Optional folder of the team's own fix procedures (.docx, .pdf, .md, .txt). When given, each incident that needs a person also lists the sections of those documents most likely to say how to resolve it… | |
segment | string | Column that splits each day into segments, for example channel or region. The control totals must have a column with the same name, where '*' means the whole day. |
threshold | Gate threshold: the largest relative gap to the control totals that a verified fix may leave and still be marked auto-fixed (0.01 = 1%). Lower is stricter. Omit for the benchmark-calibrated default, 0… |
patrol_snowflake
Check a fact table in Snowflake for data-quality incidents and say which are safe to fix. A patrol checks every daily partition of the fact table for duplicate keys, duplicate rows, missing partitions, rows that point to no reference record, null spikes, and row counts or amounts that do not match the source's control totals. For each problem it proposes a fix, tests that fix on a copy against the control totals, and decides: "auto-fixed" (proven and low risk), "no action needed" (checked, the data is right) or "escalate" (a person must decide). Use this before trusti…
| Parameter | Type | Description |
|---|---|---|
manifest_table * | string | Table of the source system's control totals, one row per date and segment, with columns: the date column, the segment column ('*' = whole day), n (row count) and amount (sum). |
ref_table * | string | Reference table that fact rows point to, for example ANALYTICS.GOLD.CUSTOMERS. |
table * | string | Fact table to check, for example ANALYTICS.GOLD.PAYMENTS. An unqualified name uses the connection's database and schema. |
amount | string | Numeric amount column in the fact table. It is compared with the 'amount' control total. |
category | Optional categorical column in the fact table. Omit if the table has none. | |
connection | Name of a connection in ~/.snowflake/connections.toml. Omit to use the server's SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD or SNOWFLAKE_PRIVATE_KEY_PATH, SNOWFLAKE_ROLE and SNOWFLAKE_WAREHO… | |
date | string | Date column the fact table is partitioned by, one partition per calendar day. The control totals must have a column with the same name. |
days | Read only the last N days of the fact table and control totals (today counts as day one). Use at least 30 so the checks have a baseline. Pass null to read the whole table, which can be slow and costly… | |
key | string | Column in the fact table that uniquely identifies a row (the primary key). |
lateness_days | integer | Give a day this many days of grace after it occurs before treating a shortfall against the control totals as broken, since it may still be waiting on late-arriving records (there is no load timestamp… |
out_dir | Folder to write the report files into. Created if missing; report files already there are overwritten. Omit to use a new temporary folder; its path comes back in outputs.folder. | |
playbook | Optional path to the team's playbook (.yml or .json) of restrictions, such as never fixing month-end days automatically. A restriction can only turn 'auto-fixed' into 'escalate', never the reverse. An… | |
ref_key | string | Column in the reference table that the fact table's reference column must match. |
reference | string | Column in the fact table that points to the reference table (the foreign key). |
runbooks_dir | Optional folder of the team's own fix procedures (.docx, .pdf, .md, .txt). When given, each incident that needs a person also lists the sections of those documents most likely to say how to resolve it… | |
segment | string | Column that splits each day into segments, for example channel or region. The control totals must have a column with the same name, where '*' means the whole day. |
threshold | Gate threshold: the largest relative gap to the control totals that a verified fix may leave and still be marked auto-fixed (0.01 = 1%). Lower is stricter. Omit for the benchmark-calibrated default, 0… |
patrol_dbt
Check the table behind a dbt model for data-quality incidents and say which are safe to fix. A patrol checks every daily partition of the fact table for duplicate keys, duplicate rows, missing partitions, rows that point to no reference record, null spikes, and row counts or amounts that do not match the source's control totals. For each problem it proposes a fix, tests that fix on a copy against the control totals, and decides: "auto-fixed" (proven and low risk), "no action needed" (checked, the data is right) or "escalate" (a person must decide). Use this after `dbt…
| Parameter | Type | Description |
|---|---|---|
model * | string | Name of the dbt fact model to check, for example fct_payments. A seed, snapshot, or a source written as source_name.table_name also works. |
project_dir * | string | Path to the dbt project folder, the one that holds dbt_project.yml. It must have been built or parsed, so target/manifest.json exists. |
amount | Numeric amount column of the fact model. Omit to use meta.dataranger.amount, or amount. | |
category | Optional categorical column of the fact model. Omit to use meta.dataranger.category, or none. | |
date | Date column the fact model is partitioned by; the control totals need the same column. Omit to use meta.dataranger.date, or txn_date. | |
days | Read only the last N days of the fact table and control totals (today counts as day one). Use at least 30 so the checks have a baseline. Pass null to read the whole table, which can be slow and costly… | |
key | Primary key column of the fact model. Omit to use meta.dataranger.key, or txn_id. | |
lateness_days | Give a day this many days of grace after it occurs before treating a shortfall as broken (see LatenessDays). Omit to use the fact model's meta.dataranger.lateness_days, or 0 if it sets none. | |
manifest_model | dbt model holding the source system's control totals: one row per date and segment ('*' = whole day) with n and amount. Omit if the fact model's meta.dataranger block sets manifest_model. | |
out_dir | Folder to write the report files into. Created if missing; report files already there are overwritten. Omit to use a new temporary folder; its path comes back in outputs.folder. | |
playbook | Optional path to the team's playbook (.yml or .json) of restrictions, such as never fixing month-end days automatically. A restriction can only turn 'auto-fixed' into 'escalate', never the reverse. An… | |
profiles_dir | Folder that holds profiles.yml. Omit to look in DBT_PROFILES_DIR, the project folder, then ~/.dbt. | |
ref_key | Key column of the reference model. Omit to use meta.dataranger.ref_key, or customer_id. | |
ref_model | dbt model of the reference table that fact rows point to, for example dim_customers. Omit if the fact model's meta.dataranger block sets ref_model. | |
reference | Fact column that points to the reference model. Omit to use meta.dataranger.reference, or customer_id. | |
runbooks_dir | Optional folder of the team's own fix procedures (.docx, .pdf, .md, .txt). When given, each incident that needs a person also lists the sections of those documents most likely to say how to resolve it… | |
segment | Column that splits each day into segments, such as channel; the control totals need the same column. Omit to use meta.dataranger.segment, or channel. | |
target | dbt target to read from, for example prod. Omit for the profile's default target. | |
threshold | Gate threshold: the largest relative gap to the control totals that a verified fix may leave and still be marked auto-fixed (0.01 = 1%). Lower is stricter. Omit for the benchmark-calibrated default, 0… |
get_incident
Return the full evidence behind one incident from a patrol that has already run. Use this after a patrol tool (patrol_duckdb, patrol_files, patrol_snowflake, patrol_dbt) or run_demo, when you need to explain why a partition was auto-fixed or escalated, or to show the user what to review. A patrol records at most one incident per partition, so the folder plus the partition date identifies it. Do not call it before a patrol. Behavior: read-only. It reads audit.jsonl in out_dir and changes nothing; no network calls, returns immediately, and the result is one record of a few…
| Parameter | Type | Description |
|---|---|---|
out_dir * | string | The outputs.folder value returned by a patrol tool or run_demo. |
partition * | string | Which incident: the partition date as YYYY-MM-DD, copied from an incident's 'partition' field, or 'table-level' for a problem with the whole table such as a schema change. |
run_demo
Run a patrol on generated sample data, to see what DataRanger reports without touching real data. Generates 60 days of synthetic payment transactions with planted problems (duplicates, missing days, orphan rows, wrong amounts and some harmless decoys), then patrols them exactly as patrol_duckdb and patrol_files do. Use this to try DataRanger, to show a user the report format, or to test your own handling of the results. Use patrol_duckdb or patrol_files for real tables. Behavior: needs no input data, credentials or network. The only side effect is writing the report f…
| Parameter | Type | Description |
|---|---|---|
out_dir | Folder to write the report files into. Created if missing; report files already there are overwritten. Omit to use a new temporary folder; its path comes back in outputs.folder. | |
seed | integer | Random seed for the generated data. The same seed on the same day gives the same table. |