Publishing a regenerable CSV export
A practical workshop for a finance extract must open everywhere. Build the smallest manifest, validate it, run it and read the result.
Context — a finance extract must open everywhere
The task is currently manual and its assumptions are not recorded. Hydra turns it into files that can be reviewed and rerun.
Where things stand
- The current result is fragile. Its assumptions are split between tools, clicks and memory.
- Reruns are uncertain. The write mode or orchestration rule is not visible beside the data.
- Evidence is missing. A colleague cannot compare a declared rule with a concrete before and after state.
The question
How do you load records into csv with explicit, testable rerun semantics?
- Keep credentials outside YAML
- Choose append, replace or upsert deliberately
- Validate before touching the target
- Verify the target after a second run
The solution in one line
A Hydra csv destination wired to a deterministic three-row fixture.
id,name,amount 1,Amina,120.5 2,Lucas,83.0 3,Sofia,49.9
Start from three known records.
Steps
1. prepare a deterministic input
- Start from three known records.
- Compare the file with the explanation in the workbench.
- Record the shown check before moving to the next step.
id,name,amount 1,Amina,120.5 2,Lucas,83.0 3,Sofia,49.9
2. declare the input
- Read the fixture as CSV.
- Compare the file with the explanation in the workbench.
- Record the shown check before moving to the next step.
version: "1.0"
sources:
input:
type: csv
connection:
base_path: "data"
extract:
table: input.csv 3. declare the csv destination
- Describe the target and write mode.
- Compare the file with the explanation in the workbench.
- Record the shown check before moving to the next step.
version: "1.0"
destinations:
target:
type: csv
connection:
base_path: "out"
load:
table: paid_orders.csv
mode: replace 4. wire the load
- Connect input to target.
- Compare the file with the explanation in the workbench.
- Record the shown check before moving to the next step.
version: "1.0" pipeline: from: input to: target
5. validate the manifest
- Catch shape and identifier mistakes.
- Compare the file with the explanation in the workbench.
- Record the shown check before moving to the next step.
$ hdrctl test csv-destination ok sources.yaml — csv ok destinations.yaml — csv ok pipeline.yaml — input → target ✅ All tests pass — ready to execute.
6. run and inspect the target
- Execute once, then verify rows and mode.
- Compare the file with the explanation in the workbench.
- Record the shown check before moving to the next step.
$ hdrctl run csv-destination ✅ Pipeline completed successfully Rows read : 3 Rows written: 3 order_id,amount O-101,120.5 O-104,83.0
Expected result
- Three rows reach the target.
- The chosen mode defines the second run.
- Credentials remain outside the manifest.
Reading the results
Rows written is the connector acceptance count. Confirm the physical target as well: files, tables, collections and APIs can impose constraints beyond the DSL.
What the counters do—and do not—prove
They prove how many records entered and left this run. They do not replace checking the target schema, the business meaning of values or the reason a workflow step was skipped.
The rule to carry forward
`replace` makes reruns idempotent; choose `append` only for a deliberately growing history.
Did we answer the question?
| objective | result | where |
|---|---|---|
| Configuration explicit | yes | the relevant YAML block |
| Safe rerun | yes | the destination or workflow policy |
| Observable result | yes | the command output and counters |
| Hidden manual rule | removed | the rule now lives in versioned text |
Before and after
- Before — a finance extract must open everywhere requires a person to remember the order, options and checks.
- After — one reviewed manifest and one command produce the same observable result.
- What is really gained — The durable gain is the contract: a colleague can read the configuration, reproduce the run and challenge the assumptions.