◐ ai-teacher

🧱 Foundations · Chapter 3

ETL vs ELT

Same three letters, different order — and the order decides what you can recover from.

Study this lesson free in the app →

The basics

ETL vs ELT is about the order of the work: Extract → Transform → Load cleans data before it lands; Extract → Load → Transform lands it raw and cleans it inside the warehouse.

The problem it solves: your transformation logic will have bugs, and the business will ask new questions. If only the cleaned version was kept, you can't redo history. Keeping raw input lets you replay any day with corrected logic.

The mental model: two cooks. The ETL cook peels vegetables at the market and throws the peels away — tidy, but when the recipe changes the market is closed. The ELT cook brings the whole crate home and chops as needed.

Today ELT is the default because storage is cheap, warehouse compute is elastic, and tools like dbt made SQL transformations testable code. Data flows through layers: raw bronze, cleaned silver, business-ready gold.

Words you must know 5

ETL / ELT
transform before vs after loading
Medallion architecture
bronze → silver → gold layers
dbt
version-controlled, tested SQL models run inside the warehouse
Idempotent
re-running a model gives the same result, no duplicates
Data contract
an agreed schema between a data producer and its consumers

Explained

ETL: transform, then load. The warehouse only ever sees the cleaned version.

ELT: load raw first, transform inside the warehouse. The raw version is still there tomorrow.

That second sentence is the entire modern shift.

Two cooks, one kitchen

Cook A (ETL) chops the vegetables outside, brings in only what the recipe needs, and throws the peels away at the market. The kitchen stays tidy. But when the chef changes the recipe on Thursday, Cook A has to go back to the market — and the market has closed.

Cook B (ELT) brings the whole crate into the kitchen, stores it, and chops as needed. More storage, but any new recipe can be cooked from what is already there — including recipes nobody thought of in January.

Why the industry moved to ELT

Three things changed:

  1. Storage got cheap. Keeping raw data costs less than the meetings about whether to keep it.
  2. Warehouse compute got elastic. Snowflake/BigQuery/Databricks can transform faster than a hand-rolled Python box.
  3. Transformations became code. dbt turned SQL models into version-controlled, tested, documented, dependency-ordered software.

So the pattern became: land raw → model in layers → serve. Usually named bronze → silver → gold, or staging → intermediate → marts.

The layer cake

BRONZE / raw      exactly as it arrived, append-only, never edited
   │              (replayable source of truth)
SILVER / clean    typed, deduped, validated, conformed keys
   │              (one row per real-world thing)
GOLD / marts      business logic, aggregates, metrics
                  (what dashboards and ML read)

Rule: every layer may only read from the layer above it. Break that and lineage becomes spaghetti.

When ETL is still the right answer

ELT is the default, not a law. Choose ETL-style pre-processing when:

In interviews say "ELT by default, ETL where compliance or payload size forces the transform earlier." That is a trade-off answer, not a fashion answer.

ETL throws away the peels at the market. ELT brings the crate home.

If you cannot re-run yesterday's logic on yesterday's data, you chose ETL — and you may not have meant to.

Gotchas

Say this

"I land raw immutably so any transform can be replayed after a logic fix. Modelling happens in the warehouse as version-controlled SQL with tests, in staging → intermediate → mart layers. The exception is PII, which I mask before landing, and high-volume payloads I filter at the edge."

Then the follow-up will be "how do you handle a schema change in the source?" — and that answer is data contracts.

Words to know

ETLExtract → Transform → Load. Clean before it lands.
ELTExtract → Load → Transform. Land raw, model inside the warehouse.
Medallion architectureBronze (raw) → Silver (cleaned) → Gold (business) layering.
dbtTool that turns warehouse SQL into tested, dependency-ordered, version-controlled models.
LineageThe traceable path showing which sources produced a given column or table.
Data contractAn agreed, enforced schema and semantics between a producer and its consumers.

In two minutes

Test yourself

1. A bug is found in a transform that has been running for 3 months. Under which pattern can you fully fix history?

  1. ETL
  2. ELT
  3. Both equally
  4. Neither
Show the answer

ELT — ELT kept the raw data, so you fix the SQL and re-run 3 months. Classic ETL discarded the untransformed input — history is only as good as what you kept.

2. What is the strongest reason to transform BEFORE loading?

  1. It is faster
  2. PII must be masked before it lands, for compliance
  3. It saves warehouse storage
  4. SQL is harder than Python
Show the answer

PII must be masked before it lands, for compliance — Legal and privacy constraints outrank architectural preference. Cost and speed arguments usually favour ELT today.

3. In a medallion architecture, which read is a smell?

  1. Gold reads from silver
  2. Silver reads from bronze
  3. A dashboard reads bronze directly
  4. Bronze reads from the source
Show the answer

A dashboard reads bronze directly — Consumers reading raw means business logic escapes into dashboards, unversioned and untested. Each layer should read only the one above it.

4. What does dbt do?

  1. Extracts data from source systems into the warehouse
  2. Streams events in real time
  3. Draws dashboards
  4. Runs version-controlled, tested SQL models inside the warehouse, in dependency order
Show the answer

Runs version-controlled, tested SQL models inside the warehouse, in dependency order — dbt is the T in ELT. It doesn't extract or load — tools like Fivetran, Airbyte or DMS do that. Confusing the two is a common interview slip.

5. A KYC event payload contains full PAN and Aadhaar numbers. What do you do?

  1. Mask or tokenise them before the data lands — raw storage must never hold them in clear
  2. Land raw and mask in the silver layer
  3. Drop the entire event
  4. Keep them, but only in a gold table
Show the answer

Mask or tokenise them before the data lands — raw storage must never hold them in clear — This is the classic case for ETL-style pre-processing. If bronze holds clear PII, every engineer with lake access can read it, and deleting it later from immutable storage is painful. 'Mask in silver' sounds tidy but leaves the raw copy exposed.

6. The app team renames fare to fare_amount in the event payload without telling anyone. You run ELT with raw JSON in bronze. What breaks?

  1. Bronze ingestion fails loudly
  2. Nothing — ELT is schema-free
  3. The silver model still reads `fare`, gets NULLs, and gold revenue silently drops
  4. The warehouse rejects the new column
Show the answer

The silver model still reads `fare`, gets NULLs, and gold revenue silently drops — Raw JSON lands happily — that's the point of bronze. The break is silent and downstream: NULL fares flow into revenue. That's why you add not-null and volume tests in silver, and why the real fix is a data contract with the producer.

There are 8 questions, 3 puzzles and 4 recall cards for this lesson in the app — the recall cards come back on later days, just before you would forget.

Learn it so it stays. Read it, test yourself, then recall it on two different days. The app schedules that for you, free.

Start this lesson →