Knowledge Sprint SeriesMT24 Learning

Phase 7 · Sprint 19/90 · Data Skepticism & Evaluation DataKimball · Caserta · Moreau · Ziemann

Data Pipelines: Extract, Transform, Load

Every row that enters a pipeline must be accounted for when it leaves.

In short. Keeping raw data read-only, types as claims (spreadsheets that turn gene names into dates), loads that are safe to run twice, and ETL against ELT.

Sprint 19 of 90 infographic: Data Pipelines: Extract, Transform, Load. Every row that enters a pipeline must be accounted for when it leaves. The full text of the image is on this page.
Full resolution2160 × 2700 PNGPhase summary

The part of the image you are reading lights up. Tap a part to jump to its text.

Fig. 1 in words

  1. One batch of six rows, run twice · same data as code 05

    • Run 2 · same raw file → table still 3 rows (a dashed line from the table back to the raw file)
    • ① RAW.CSV · 6 rows · read-only
    • a gauge on the pipe: FI 6 · E · Extract
    • ② T · Transform · type · date · key · checks every row
    • Quarantine · 2 rows · id 3 '1-Mar' · id 4 'n/a'
    • Merged · 1 row · id 2 appears twice
    • a gauge on the pipe: FI 3 · ③ L · Load
    • TABLE g · 3 rows · key: id
    • ④ Reconcile · 6 = 3 + 1 + 2 · in = load + dup + rejected

01 Copy, Don't Edit Extract

  • Pull each source as it is. Keep the raw copy read-only
  • Stamp each batch with source, time and version (W3C PROV: entity, activity, agent)
  • Read a fixed window, never "the latest" (Airflow)

If the raw file changes, a rerun is a different experiment.

02 Types Are Claims Transform

  • Declare each column's type. Never let a tool guess it
  • Spreadsheet guessing turns gene names into dates (SEPT2 → 2-Sep): errors in 19.6% of papers with Excel gene lists, 2005–2015
  • Still 30.9% of such papers in 2014–2020

Ziemann et al. 2016 · Abeysooriya et al. 2021. The genes were renamed instead: SEPTIN1, MARCHF1.

03 Safe to Run Twice Load

  • Idempotent: the same outcome on every re-run (Airflow)
  • Replace or upsert on a key, or overwrite one partition
  • Code 05 holds 3 rows after both runs. Plain INSERT with no key: 6

With a key, a plain INSERT fails loudly on run 2. Without one it doubles quietly.

04 ETL or ELT Order

  • ETL: transform in a separate engine, often via staging tables, then load
  • ELT: load raw, transform inside the target store
  • Either way, check before anyone reads the table

Microsoft Azure docs. Kimball & Caserta (2004) estimate ETL at about 70% of a warehouse's resources.

05 Try It Yourself

sprint19_data_pipelines_extract_transform_load.py

import csv, re, sqlite3
RAW = """1,TP53,0.91
2,SEPT2,0.40
2,SEPT2,0.40
3,1-Mar,0.77
4,BRCA1,n/a
5,EGFR,0.63"""
LOAD = ("INSERT OR REPLACE INTO g"
        " VALUES (?,?,?)")
db = sqlite3.connect(":memory:")
db.execute("CREATE TABLE g(id INTEGER"
           " PRIMARY KEY, gene, score)")
def run():
    rows = [*csv.reader(RAW.split())]   # E
    ok, bad = {}, []
    for i, gene, s in rows:             # T
        try:
            if re.match(r"\d+-", gene):
                raise ValueError(gene)
            ok[i] = int(i), gene, float(s)
        except ValueError: bad.append(i)
    db.executemany(LOAD, ok.values())   # L
    n, = db.execute("SELECT COUNT(*) FROM g"
                    ).fetchone()
    print(len(rows), len(ok), bad, n)
run(); run()

Output, as printed on the image

6 3 ['3', '4'] 3
6 3 ['3', '4'] 3

Run it. sprint19_data_pipelines_extract_transform_load.py · versions, data and steps

Check: 6 = 3 + 1 + 2 (loaded, duplicate, rejected). Python 3.11.15 · sqlite3 3.45.1

06 General Notes Skepticism

  • Count rows in and out of every stage
  • Quarantine bad rows with a reason. Never drop them silently
  • Keep spreadsheets out of the pipe: .xls saves 65 536 rows
  • England, Oct 2020: 15 841 cases missed the daily count when a file hit its limit (PHE)

07 Mini Project Hands-on

  • Take one CSV you use. Write E, T and L as three functions
  • Log the count at each stage. Fail the run if they don't match
  • Run it twice. Then use a plain INSERT without a key and watch 3 become 6
  • Open the raw CSV in a spreadsheet, save it, diff it

R Trusted Sources

  1. Kimball & Caserta (2004). The Data Warehouse ETL Toolkit. Wiley
  2. Microsoft Learn: Extract, transform, load (ETL)
  3. Worksheet compatibility issues
  4. Apache Airflow: Best Practices
  5. SQLite: ON CONFLICT
  6. Moreau & Missier, eds. (2013). PROV-DM. W3C
  7. Ziemann, Eren & El-Osta (2016). Genome Biol. 17, 177
  8. Abeysooriya et al. (2021). PLOS Comput. Biol. 17(7), e1008984
  9. PHE (4 Oct 2020). Delayed reporting of COVID-19 cases

Cite this phase

Tahri, M. (2026). MT24 Learning — Knowledge Sprint Series, Phase 7: Data Skepticism & Evaluation Data (Version 1.0) [Educational resource]. Zenodo. https://doi.org/10.5281/zenodo.23189539

Version DOI 10.5281/zenodo.23189539 · all versions 10.5281/zenodo.23189538 · first published 1 October 2026