$ etl run nightly_sales --date 2026-11-15

ETL

ETL (Extract, Transform, Load) is a data integration pattern that pulls data out of source systems, cleans and reshapes it in a separate processing engine, and only then loads the finished result into a target such as a data warehouse. The warehouse never sees raw data: it receives tables that are already deduplicated, typed, joined and ready for reports.

ETL is the classic pattern from the era when warehouse compute was expensive and limited. Today ELT is the default for analytics, but ETL is still the right call when data must be filtered, masked or validated before it is allowed into the target.

How it works

$ etl run nightly_sales
Extract, transform in staging, then load
POSTGRESorders SFTP · CSVstores.csv REST APIfx rates ETL ENGINE · STAGING WAREHOUSEfct_orders extract drop 3 rows: null amount dedupe 12 repeated ids join fx → amount_usd mask phone numbers load clean rows only raw extract discarded new rule next month? re-extract from sources
  1. Three sources: an orders database, a CSV of stores dropped on SFTP, and an API with exchange rates. One warehouse table is the goal.
  2. Extract: the job pulls yesterday's rows from each source into the engine's staging area, usually on a nightly schedule.
  3. Transform: clean, deduplicate, join and mask, all outside the warehouse, in Spark, Python or an ETL tool.
  4. Load: only the finished, modeled rows are written to the warehouse. Analysts never see the mess.
  5. The cost: raw data usually isn't kept, so a new business rule means re-extracting history from the sources, if they still have it.

The three steps

  • Extract: read from databases, files, APIs and SaaS tools. Prefer incremental extraction (only rows changed since the last run, using an updated_at column or CDC) over full dumps, and read from a replica so the production database isn’t slowed down.
  • Transform: cleansing (nulls, bad formats), standardizing (units, currencies, time zones), deduplication, joins and lookups, aggregation, and business rules such as “a cancelled order doesn’t count as revenue”.
  • Load: write to the target. Make it idempotent: re-running the job for 2026-11-15 should replace that day’s data, not append it twice. Use MERGE / upsert or overwrite-by-partition.

ETL vs ELT

ETL ELT
Where transforms run Separate engine (Spark, ETL tool) Inside the warehouse (SQL, dbt)
What lands in the target Clean, modeled tables Raw copies first, models on top
Re-processing history Re-extract from sources Re-run SQL on stored raw data
Sensitive data Can be masked before it lands Lands raw, must be secured in place
Best fit Strict compliance, heavy non-SQL logic, small or legacy targets Cloud warehouses and lakehouses

When ETL is still the right choice

  • PII or regulated data that may not be stored unmasked in the analytics platform.
  • Heavy non-SQL work: parsing binaries or documents, ML feature extraction, image or geo processing.
  • Targets that can’t transform: an operational database, a search index, a small on-prem warehouse.
  • Reducing volume: aggregating billions of IoT readings before loading saves storage and cost.

Common mistakes

  • Non-idempotent loads that append duplicates when a job is retried.
  • Full extracts every night of tables that only change by 1 percent.
  • No data quality checks between transform and load, so bad data is published silently.
  • Business logic hidden in a GUI tool with no version control or tests.

Learning Resources

Books

Articles and videos

See also: ELT, Pipeline Orchestration