Hydra ETL
Build your first job
Workshop 8 · 20 minutes

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.

data/input.csv6 steps
id,name,amount
1,Amina,120.5
2,Lucas,83.0
3,Sofia,49.9
What you do

Start from three known records.

Step 1 · fixture ready

Steps

1. prepare a deterministic input

  1. Start from three known records.
  2. Compare the file with the explanation in the workbench.
  3. 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
Check — three input records

2. declare the input

  1. Read the fixture as CSV.
  2. Compare the file with the explanation in the workbench.
  3. 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
Check — input is local and deterministic

3. declare the csv destination

  1. Describe the target and write mode.
  2. Compare the file with the explanation in the workbench.
  3. 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
Check — target identifier ready
Trap — `replace` makes reruns idempotent; choose `append` only for a deliberately growing history.

4. wire the load

  1. Connect input to target.
  2. Compare the file with the explanation in the workbench.
  3. Record the shown check before moving to the next step.
version: "1.0"
pipeline:
  from: input
  to: target
Check — the three rows will reach the target

5. validate the manifest

  1. Catch shape and identifier mistakes.
  2. Compare the file with the explanation in the workbench.
  3. 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.
Check — load configuration valid

6. run and inspect the target

  1. Execute once, then verify rows and mode.
  2. Compare the file with the explanation in the workbench.
  3. 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
Check — three rows written
Trap — rerun behaviour matches the declared mode

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?

objectiveresultwhere
Configuration explicityesthe relevant YAML block
Safe rerunyesthe destination or workflow policy
Observable resultyesthe command output and counters
Hidden manual ruleremovedthe 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.

Close by

0 / 0 on this page