# Convert NACHA ACH files to queryable Apache Iceberg tables

**NACHA ACH files — 94-character fixed-width bank records — become
typed, queryable Iceberg tables with one scan-approve-load pass.**
Lakewright identifies NACHA by record-type structure (no extension
needed), derives entry-detail columns from the spec positions, and
lands amounts as decimals with trace numbers intact.

## What is a NACHA file?
The fixed-width format U.S. banks use for ACH payment batches: file
header (type 1), batch headers (5), entry details (6), addenda (7),
control records (8/9). 94 characters per line, positions defined by
the NACHA operating rules — no headers, no delimiters.

## How are columns derived?
From the record-type layout: routing numbers, account (maskable),
amount (implied decimal, converted), individual name, trace number.
Account numbers are flagged sensitive at scan; plans default them to
masked. Batch/file control totals are available for reconciliation
checks downstream.

## The steps
```bash
lakewright scan  sftp-drop/payroll/        # NACHA detected, PII flagged
lakewright plan  sftp-drop/payroll/ --out plans
lakewright approve plans/ach_payroll.plan.yaml
lakewright load  plans/ach_payroll.plan.yaml --rest $ICEBERG_CATALOG
```
Query from Snowflake, Databricks, Trino, or DuckDB — it's standard
Iceberg. BAI2 balance reporting files follow the same pattern.

## FAQ
**Same-day re-drops?** Content-digest journaling makes re-loads
no-ops — the same file never lands twice.
**Returns/NOCs?** They're NACHA files too; they land as their own
feed and join on trace number.
