Skip to content

vgrid export

Export canonical financial truth data as deterministic CSV seeds and a JSON manifest. Designed for dbt workflows — the output can be seeded directly into a warehouse for verification against transformed data.

Terminal window
vgrid export truth --transactions <file.csv> [options]
vgrid export truth --daily-totals <file.csv> [options]
OptionDescription
--transactionsInput truth_transactions.csv (full transaction detail)
--daily-totalsInput truth_daily_totals.csv (skip transaction aggregation)
--outOutput directory (default: seeds/)
-q, --quietSuppress stderr output

Provide either --transactions or --daily-totals, not both.

Terminal window
# From transaction-level data → seeds/
vgrid export truth --transactions stripe_truth.csv
# Custom output directory
vgrid export truth --transactions data/truth.csv --out dbt_seeds/
# From pre-aggregated daily totals (skip aggregation)
vgrid export truth --daily-totals daily_totals.csv --out seeds/

When using --transactions:

FileDescription
seeds/truth_transactions.csvDeterministic, sorted canonical transactions
seeds/truth_daily_totals.csvAggregated daily totals by (date, currency, source_account)
seeds/truth_manifest.jsonHashes, metadata, schema version

When using --daily-totals:

FileDescription
seeds/truth_daily_totals.csvRe-written deterministically
seeds/truth_manifest.jsonHashes and metadata

The input truth_transactions.csv must have these columns:

source,source_account,source_id,occurred_at,posted_at,currency,direction,amount_gross,fee_amount,amount_net,counterparty,description,raw_hash
ColumnTypeDescription
sourcestringData source (e.g. stripe, mercury)
source_accountstringAccount identifier
source_idstringTransaction ID from source
occurred_atdateTransaction date (YYYY-MM-DD)
posted_atdate or emptySettlement date
currencystringISO 4217 code (e.g. USD)
directionenumcredit or debit
amount_grossdecimalGross amount in micro-units (6 decimal places)
fee_amountdecimalFee amount in micro-units
amount_netdecimalNet amount in micro-units
counterpartystring or emptyOther party
descriptionstring or emptyTransaction description
raw_hashstringSource row fingerprint

The truth_daily_totals.csv format (both input and output):

date,currency,source_account,total_gross,total_fee,total_net,transaction_count

All amounts are in micro-units (1e-6 of currency unit). $100.00 = 100.000000.

Aggregation rules:

  • Gross/Net: credits are positive, debits are negative (signed sum)
  • Fee: always non-negative (absolute sum)
  • Sorted by: date, currency, source_account
  • Single-account enforcement: all transactions must share the same source_account
{
"schema_version": "1.0",
"transactions_hash": "abc123...",
"daily_totals_hash": "def456...",
"source_account": "acct_demo_001",
"date_range": { "min": "2026-01-15", "max": "2026-01-18" },
"transaction_count": 10,
"daily_totals_rows": 4,
"mapping_profile_hash": null
}

Hashes use BLAKE3. The manifest provides a tamper-evident summary of the exported data.

The same input data in any order produces byte-identical output CSVs. This is critical for:

  • Hash stability across runs
  • Reproducible dbt seeds
  • Proof chain integrity

Transactions are sorted by (occurred_at, source_id). Daily totals are sorted by (date, currency, source_account). Amounts are always formatted to exactly 6 decimal places.

The output is designed as dbt seed input:

Terminal window
# 1. Export truth seeds
vgrid export truth --transactions stripe_truth.csv --out seeds/
# 2. Seed into warehouse
dbt seed
# 3. Build warehouse model (produces warehouse_daily_totals)
dbt run
# 4. Verify truth vs warehouse
vgrid verify totals seeds/truth_daily_totals.csv warehouse_daily_totals.csv \
--sign --proof proof.json