Highlights

Contents

Part V
05

ETL, ELT, warehouses, and lakes

We choose where transformation happens and where data waits. Storage names do not establish schema quality or governance. We will trace ETL and ELT, warehouse tables, lake files, and the metadata needed to interpret them.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1OLTP vs OLAP2Batch processing3Stream processing4Event time, windows,watermarks5ETL, ELT, warehouses, andlakes6CDC and materializedviews7Checkpoints andexactly-once8Spark and Flink9Case study: score toreport

#Section 17ETL transforms before the target

A source event contains a team identifier and a scoring value. The pipeline extracts it, validates and transforms it, then loads a cleaned target row. ETL means extract, transform, and load in that order. The target receives the prepared representation instead of every raw source field.

This can enforce a target contract early and avoid carrying unnecessary sensitive data downstream. It also makes the transformation pipeline a dependency for loading. A bug in the transform may require replay from retained raw inputs or the authoritative source. Keep a source identity and transformation version so a target row can be explained.

ETL: TRANSFORM IN THE MIDDLE, LOAD ONLY CLEAN ROWSETL: TRANSFORM IN THE MIDDLE, LOAD ONLY CLEAN ROWSextractfrom sourcevalidate + transformtransform v7loadclean rowsqueryanalystsearly contract, less sensitive data downstream; a transform bug means re-extracting
Figure 17.17Illustrative ETL order. Input identity and transformation version travel into lineage or operational metadata.

Transformation can include type conversion, normalization, reference-data joins, and derived fields. It is not necessarily a large distributed job. A small deterministic process can be enough for a small workload. Match the processing tool to the actual data size, latency, and recovery requirement rather than choosing a framework before the query is known.

#Section 18ELT loads a raw representation first

The source sends accepted records into a durable target, and transformations later produce query-oriented tables there. ELT means extract, load, and transform. It preserves an earlier target copy of the source representation, which can support multiple derived views and repaired transformations.

Raw does not mean unvalidated or permanently retained. Check format, size, source authenticity, and sensitive-field policy before loading. A malformed or hostile payload can damage downstream availability, while personal data still has retention and access rules. The raw layer also needs a schema or metadata contract sufficient to interpret its bytes later.

ELT: LOAD RAW INTO A CONTROLLED AREA, THEN DERIVE TABLES IN THE WAREHOUSEELT: LOAD RAW INTO A CONTROLLED AREA, THEN DERIVE TABLES IN THE WAREHOUSEextractfrom sourceraw targetgovernedtransform v7in warehousederived tablesanalystsraw is still validated for format, size and sensitive fields, with retention rules
Figure 17.18Illustrative ELT order. Controlled raw storage still validates boundaries and applies access and retention rules.

A loaded raw dataset should identify which schema version produced each record and how readers resolve it. Adding an optional field can be compatible under a stated rule; changing a field meaning is a semantic migration. Keep transformation code aware of supported versions. Otherwise delayed old records can be parsed using a newer meaning and create plausible wrong answers.

ETL and ELT can coexist. A minimal extraction transform can remove secrets, while analytical transformations occur in the destination. The useful design question is which stage owns each validation, semantic change, and replayable boundary. The acronym alone does not explain correctness or data quality.

#Section 19A warehouse serves structured analytical questions

An analyst wants a consistent table of match totals and team dimensions. A data warehouse is a managed analytical store organized to support such queries over integrated data. It often uses structured tables and query-oriented execution, but its exact architecture depends on the system.

A fact table stores measurable events or observations, while a dimension table stores descriptive context such as team or venue. Joining a score fact to a team name seems simple until the name changes. If the report needs the historical name, store a versioned dimension or effective-time relationship. If it needs the current name, state that interpretation.

A FACT ROW POINTS TO DIMENSIONS; WHICH VERSION OF "TEAM NAME" IT JOINS IS A CHOICEA FACT ROW POINTS TO DIMENSIONS; WHICH VERSION OF "TEAM NAME" IT JOINS IS A CHOICEmatch_runs (fact)event_id · team_keyvenue_key · runsteam (dimension)name valid from/tovenue (dimension)a renamed team: join the name as of the match, or as of today?
Figure 17.19Illustrative analytical schema. Dimension history determines what past facts mean when descriptive attributes change.

Define grain before summing. Grain is what one row represents, such as one accepted scoring event or one match-day total. Joining a one-event table to multiple tags can multiply rows and inflate sums. A correctly stored warehouse can still produce wrong totals through an incorrect query relationship.

#Section 20A lake stores files with another interpretation layer

Heron retains raw event files for repair and additional analyses. A data lake stores data, often in object storage, for later processing and interpretation. It can contain structured column files, raw messages, media, and other formats. Its value is storage flexibility, not an automatic absence of schema.

A catalogue records datasets, schemas, locations, ownership, and other interpretation metadata. A table format can coordinate file membership, snapshots, and updates for a logical table. Without a reliable metadata boundary, a directory of files can expose partial writes or inconsistent file sets to different readers.

FILES IN A BUCKET BECOME A TABLE ONLY WITH A SCHEMA, A CATALOGUE AND A SNAPSHOT MANIFESTFILES IN A BUCKET BECOME A TABLE ONLY WITH A SCHEMA, A CATALOGUE AND A SNAPSHOT MANIFESTobject filesschema +cataloguesnapshot manifesta folder is not a transaction; the manifest says which files are the table
Figure 17.20Illustrative controlled lake path. Storage bytes and logical table visibility are separate responsibilities.

Small files create listing, open, and metadata overhead. Under an illustrative file-per-minute policy, Heron creates 1,440 daily files of 240,000 payload bytes each. Combining a day’s 345,600,000 bytes into target chunks of 128,000,000 requires three files by ceiling division. These are teaching sizes, not recommended universal file settings.