The previous lesson ended by pointing out two weaknesses of classic ETL: transforming before storing prevents reprocessing, and the business logic ends up hidden in programs that the people accountable for it do not read. ELT (Extract, Load, Transform) answers both with a change of order: the data is loaded first, just as it arrives, and transformed afterwards inside the destination itself, usually with SQL.
The change looks small, and it is not. It turns the transformation into a set of SQL queries that can be versioned, tested and documented like any other code, and that an analyst like Laura can read. In this lesson we will see why ELT emerged, when it is preferable to ETL, how transformations are organized in layers and how transformation tools such as dbt work. We will finish with ADR-009, which sets DataCorp's approach and settles an open item from lesson 03-03: which tool is used to implement the quality rules.
Why ELT emerged
Classic ETL transformed outside the warehouse because the warehouse was a scarce resource: a fixed-capacity, expensive server on which every heavy query competed with the reports. Three technical changes undid that premise:
- Elastic compute in the destination. Cloud analytical engines run a heavy transformation with capacity that is paid for by the minute and released when it finishes. Transforming inside no longer takes capacity away from anyone.
- Separation of storage and compute. Storing data and processing it are paid for separately (one of the principles of lesson 01-04). Storing the raw data costs cents per gigabyte, so there is no longer any economic reason to filter before storing.
- Columnar engines with full SQL. Deduplicating with window functions, flattening JSON or joining millions of rows is done in SQL, with no need for a programming language.
On top of that comes an architectural reason that DataCorp has already adopted: keeping the raw data (ADR-002). If the raw data is always available in the destination, any transformation can be corrected and rerun over the whole history without asking the source for anything. Transformation stops being an irreversible operation.
graph LR
subgraph "ETL"
F1["Sources"] --> M["Intermediate engine<br/>(transforms)"] --> D1["Destination<br/>(final data only)"]
end
subgraph "ELT"
F2["Sources"] -->|"extract and load"| B["Raw"]
B -->|"SQL"| DE["Cleansed"]
DE -->|"SQL"| C["Consumption"]
end
ETL versus ELT
| Aspect | ETL | ELT |
|---|---|---|
| Where the transformation happens | On an intermediate engine or server | In the analytical destination |
| What reaches the destination | Transformed data only | The raw data, with the derived layers built on top of it |
| Usual language | Python, Java or a graphical tool | SQL |
| Reprocessing after a rule changes | Extract again (if the source still has the data) | Rerun the query on the raw data |
| Who can read the logic | Engineering | Engineering and analysts |
| Scaling | That of the intermediate engine | That of the destination's compute |
| Sensitive data | Can be filtered out before it arrives | Reaches the raw zone: requires access controls on that zone |
| Characteristic cost | Your own transformation infrastructure | The destination's compute; the raw data takes up space |
| Best fit | Destinations with no compute capacity; mandatory prior anonymization; transformations that cannot be expressed in SQL | Elastic analytical engines; teams with SQL skills; a need to reprocess |
The criteria for deciding come down to four questions:
- Can the destination transform at a reasonable cost? If not, ETL.
- Is the original data allowed to reach the destination? If a regulation requires anonymizing before the data leaves its system, that part has to be done before loading.
- Can the transformation be expressed in SQL? Interpreting a PDF or applying a language model to free text cannot; cleansing orders can.
- Who maintains the logic? If the people who define the metrics read SQL, ELT brings the code closer to them.
The hybrid approach: EtLT
In practice almost nobody does pure ELT. The usual thing is EtLT: a minimal, technical transformation (the lowercase t) before loading, and the business transformation (the uppercase T) in the destination.
| Lowercase t (before loading) | Uppercase T (in the destination) | |
|---|---|---|
| Nature | Technical, with no business decisions | Business: rules, definitions, models |
| Examples | Compressing, adding load_date, excluding a forbidden field, flattening a format the destination cannot read |
Deduplicating, validating, converting time zones, calculating net sales |
| If it changes | Rarely | Frequently |
The boundary is clear: nothing that depends on a glossary definition is done before loading. At DataCorp, the t is limited to writing each extraction in its original format, compressed and in its load_date partition (ADR-004).
In-destination transformation in layers
Transforming in the destination does not mean writing one gigantic query from the raw data to the dashboard. You move forward in layers, each with a purpose, which match the zones defined in lesson 01-03:
| Layer (schema) | What it contains | Its own transformations | Who reads it |
|---|---|---|---|
raw |
What was ingested, as is, with all its copies | None | Engineering only (role_data_engineering) |
cleansed |
One table per entity, clean, typed, with no duplicates: the canonical model | Types, time zones, deduplication, standardization, validation | Engineering; analysts, without personal data |
intermediate |
Reusable calculation steps, with no value on their own | Joins and preliminary calculations | Nobody outside the transformations |
consumption |
Dimensional model and metric tables | Surrogate keys, business rules, aggregations | Analysts and reporting tools |
So that the analytical engine can read the raw zone with SQL, the files in the datacorp-data-raw bucket are exposed as external tables: definitions that point to a file path and allow it to be queried like a table (raw.orders, raw.order_lines...), with the load_date partition as one more column. The data is not copied.
Intermediate models exist to avoid repeating logic. If the join of lines with orders is needed by fact_sales and, tomorrow, by a returns model, it is written once in an intermediate model and both reuse it. They carry the int_ prefix, which DataCorp adds to the POL-02 naming convention.
Two rules keep the layers clean: each layer reads only from the previous one (a consumption model never reads from the raw data) and each business rule is written in a single model. The second is requirement RQ-11 turned into a coding standard.
Transformation tools: what dbt brings
A set of .sql files run in order by a script would already be ELT. But the questions soon come up: in what order? What happens if the third one fails? How do I test a change without touching production? Who checks that the result is correct?
Transformation tools solve that. The most widespread one is dbt (data build tool), which has an open-source version (dbt Core) and is the one we will use as a reference; there are others with the same approach, such as SQLMesh or Dataform. What a tool of this kind does:
- It does not extract or load. It deals only with the T: it assumes the data is already in the destination.
- It does not process data. It generates SQL and sends it to the analytical engine, which is the one that does the work.
- It adds to SQL what it lacks to be engineering: dependencies, execution order, tests, documentation, environments and version control.
At DataCorp, the transformations project lives in the transformations/ folder of the datacorp-data repository:
transformations/
dbt_project.yml # project configuration
models/
sources.yml # declaration of the raw zone tables
cleansed/
orders.sql # one file = one model = one table or view
order_lines.sql
customers.sql
products.sql
cleansed.yml # descriptions and tests for this layer
intermediate/
int_lines_with_order.sql
consumption/
dim_product.sql
dim_customer.sql
fact_sales.sql
daily_net_sales.sql
consumption.yml
seeds/ # small CSV files that are loaded as tables
ref_order_status.csv
ref_city_alias.csv
tests/ # tests written as SQL queries
dq_05_amount_matches_lines.sql
dq_08_net_sales_reconciliation.sqlThe reference tables that lesson 03-06 stored as CSV files in reference/ fit the seeds mechanism: small, versioned files that the tool loads as tables.
Models, references and the dependency graph
A model is a file with a single SELECT statement. It contains no CREATE TABLE or INSERT: the tool takes care of wrapping the SELECT in the appropriate statement. The name of the file is the name of the resulting table.
Inside the SELECT, tables are not named directly. Two functions are used, written between double curly braces (the Jinja templating syntax that dbt processes before sending the SQL):
| Function | What for | Example |
|---|---|---|
{{ source('raw', 'orders') }} |
Reading a table that the tool does not create (the raw zone) | It is translated into raw.orders |
{{ ref('orders') }} |
Reading another model in the project | It is translated into cleansed.orders |
ref has two effects. It replaces the name with the correct schema in each environment (in development, the model is read from each person's test schema). And, above all, it declares a dependency: with all the references, the tool builds a dependency graph and works out the execution order. Nobody writes "first this, then that".
graph LR
SP["raw.orders"] --> P["cleansed.orders"]
SL["raw.order_lines"] --> L["cleansed.order_lines"]
SC["raw.customers"] --> C["cleansed.customers"]
SR["raw.products"] --> R["cleansed.products"]
P --> I["int_lines_with_order"]
L --> I
C --> DC["dim_customer"]
R --> DP["dim_product"]
I --> H["fact_sales"]
DC --> H
DP --> H
H --> V["daily_net_sales"]
DC --> V
DP --> V
The graph also makes it possible to run just a part: "this model and everything that depends on it", or "everything needed to build daily_net_sales".
Materializations
The materialization is the way a model becomes an object in the destination. It is declared in the model itself and can be changed without touching the SELECT:
| Materialization | What it creates | Cost at run time | Cost at query time | Use it for |
|---|---|---|---|---|
| View | A view: the query runs every time someone reads it | None | High if the logic is heavy | Lightweight or rarely queried models |
| Table | A table that is rebuilt in full on every run | Proportional to the total data | Low | Small or medium-sized tables; dimensions |
| Incremental | A table into which only new or changed rows are inserted or updated | Proportional to the change | Low | Large tables that grow: facts, events |
| Ephemeral | Nothing: the SELECT is embedded in the models that use it |
None | That of the model that includes it | Small intermediate steps |
The rule of thumb is to start with the simplest option and add complexity only when the run time calls for it: view → table → incremental. A table that is rebuilt in full is idempotent with no effort; an incremental model is faster, but you have to think carefully about which rows are reprocessed.
| DataCorp models | Materialization | Reason |
|---|---|---|
cleansed.* |
Table | The deduplication over all the raw data must be calculated once, not on every read |
int_lines_with_order |
Ephemeral | It exists only to simplify fact_sales |
dim_product, dim_customer |
Table (the customer one, with type 2 history) | Modest size |
fact_sales |
Incremental, key line_id |
It grows by 3,750 lines a day on top of millions |
daily_net_sales |
Table | A small aggregate, quick to recalculate in full |
The details of the type 2 load of dim_customer do not change from what we saw in lesson 04-01; tools of this kind also offer their own mechanisms for capturing history (in dbt, snapshots).
Example: the cleansed orders model
This model replaces the cleanse_orders function of the previous lesson's program. The logic is the same; now it is SQL that runs on the analytical engine.
-- models/cleansed/orders.sql
{{ config(materialized='table') }}
with copies as (
-- All the copies of each order that exist in the raw zone, numbered
select
order_id,
customer_id,
order_date,
lower(trim(status)) as status,
total_amount,
load_date,
row_number() over (
partition by order_id
order by load_date desc -- the most recent copy first
) as row_num
from {{ source('raw', 'orders') }}
)
select
cast(c.order_id as bigint) as order_id,
cast(c.customer_id as bigint) as customer_id,
-- The source stores Spanish mainland time without saying so: it is declared and the timestamp obtained
cast(c.order_date as timestamp) at time zone 'Europe/Madrid' as order_date,
cast(c.order_date as date) as business_date,
c.status,
cast(c.total_amount as numeric(10, 2)) as total_amount,
c.load_date
from copies c
join {{ ref('ref_order_status') }} e -- allowed statuses only (DQ-03)
on e.code = c.status
where c.row_num = 1config(materialized='table'): the result will be a table, rebuilt on every run.with copies as (...): a common table expression (CTE), a named query that is used right afterwards. It applies the deduplication of lesson 03-05: it numbers the copies of each order and, further down, keepsrow_num = 1.- Type conversion: in the raw zone everything arrives as text (the file is a CSV); each
castsets the canonical type. - Time zone:
at time zone 'Europe/Madrid'interprets the time as Spanish mainland time and returns the exact timestamp, which the engine stores in UTC. The syntax varies from one engine to another. The business date is simply the date part of the local time. joinwithref_order_status: only the orders whose status appears in the reference table get through. The list of valid statuses is no longer a constant in a program, but a table maintained by its steward.
The orders that this join discards are not lost: a sibling model, orders_quarantine, selects exactly the opposite ones (with a left join and where e.code is null), adds rejection_reason = 'DQ-03' to them and writes them to the quarantine path defined in lesson 03-03.
If Carmen approves a new status, all it takes is adding a line to ref_order_status.csv and running again: since the raw zone keeps every order, the ones that were in quarantine move to the cleansed table. That was exactly what the ETL of the previous lesson could not do.
Example: fact_sales as an incremental model
-- models/consumption/fact_sales.sql
{{ config(materialized='incremental', unique_key='line_id') }}
select
l.line_id,
l.order_id,
cast(to_char(l.business_date, 'YYYYMMDD') as integer) as date_sk,
coalesce(c.customer_sk, 0) as customer_sk,
coalesce(p.product_sk, 0) as product_sk,
l.status as order_status,
l.quantity,
cast(l.quantity * l.unit_price as numeric(12, 2)) as gross_amount,
cast(l.quantity * l.unit_price / 1.21 as numeric(14, 4)) as net_amount
from {{ ref('int_lines_with_order') }} l
left join {{ ref('dim_customer') }} c
on c.customer_id = l.customer_id
and l.business_date >= c.valid_from
and l.business_date < c.valid_to
left join {{ ref('dim_product') }} p
on p.product_id = l.product_id
{% if is_incremental() %}
-- Only on incremental runs: the orders in the window that the extraction
-- brings in again every night (60 days) are reprocessed
where l.business_date >= date '{{ var("load_date") }}'
- interval '{{ var("reprocess_days", 60) }}' day
{% endif %}materialized='incremental'andunique_key='line_id': the tool generates aMERGElike the one in the previous lesson. The lines that already exist are updated (that is howorder_statuschanges when an order is returned) and the new ones are inserted.int_lines_with_order: the intermediate model that joins each line with the data of its order (customer_id,business_date,status).- Surrogate keys: the lookups with
left joinandcoalesce(..., 0)from the previous lesson. The customer one picks the version in effect on the day of the order. {% if is_incremental() %}: the block is included only when the table already exists. The first time, or when a full rebuild is requested, the whole history is processed.var("load_date"): a parameter that is passed at run time. Once again, the date is not taken from the clock: rerunning the load for November 18 always reprocesses the same window.
The run for the night of November 18:
build runs the models in graph order and, after each one, its tests; if a test with error severity fails, the models that depend on it are not built.
Tests: quality rules as code
A test, in these tools, is a query that looks for rows that break a condition: if it returns zero rows, it passes. It is the same idea as in lesson 03-03, which is why the DQ rules carry over almost literally.
There are four generic tests, which are declared in YAML without writing any SQL:
| Generic test | Checks | DataCorp rules |
|---|---|---|
unique |
That there are no repeated values | DQ-01 (order_id), grain of fact_sales |
not_null |
That there are no nulls | DQ-02 |
accepted_values |
That the value belongs to a list | DQ-03 |
relationships |
That each value exists in another table (referential integrity) | DQ-04, DQ-12 |
# models/consumption/consumption.yml
version: 2
models:
- name: fact_sales
description: "Sales at order line level. Grain: one row per line."
columns:
- name: line_id
description: "Identifier of the order line in the store."
data_tests:
- unique # the grain holds
- not_null
- name: product_sk
data_tests:
- not_null
- relationships: # every key exists in the dimension
to: ref('dim_product')
field: product_sk
- name: order_status
data_tests:
- accepted_values: # DQ-03
values: ['pending', 'paid', 'shipped',
'delivered', 'cancelled', 'returned']
- name: net_amount
description: "Amount excluding VAT (gross_amount / 1.21), with 4 decimal places."
data_tests:
- not_null(In earlier versions of dbt the key is called tests instead of data_tests.)
The rules that do not fit the four types are written as singular tests: a SQL file that returns the incorrect rows. The DQ-08 reconciliation:
-- tests/dq_08_net_sales_reconciliation.sql
-- Fails if the net sales in consumption differ from those calculated on cleansed
{{ config(severity='error') }}
with in_consumption as (
select sum(net_amount) as net_sales
from {{ ref('fact_sales') }}
where order_status not in ('cancelled', 'returned')
),
in_cleansed as (
select sum(total_amount) / 1.21 as net_sales
from {{ ref('orders') }}
where status not in ('cancelled', 'returned')
)
select c.net_sales as consumption, d.net_sales as cleansed
from in_consumption c
cross join in_cleansed d
where abs(c.net_sales - d.net_sales) > 0.01The severities of lesson 03-03 map as follows:
| DataCorp severity | Implementation |
|---|---|
| Blocking | Test with severity: error: it stops the build of whatever depends on it |
| Warning | Test with severity: warn: it is logged and the run continues |
| Quarantine | It is not a test, but a model: the rows are set aside in <entity>_quarantine |
After each run, the test results are written to quality.rule_results, which is where the quality index per domain comes from. The checks on ingestion (DQ-06 and DQ-07, which run before there is anything to transform) are outside the scope of these tests and will remain a small Python program.
Generated documentation and lineage
The descriptions written in the YAML files, together with the dependency graph, allow the tool to generate a documentation site: each model with its columns, its tests, the SQL that produces it and a navigable diagram of its lineage.
For DataCorp this gives concrete shape to the "catalog as code" decided in lesson 03-02:
- Table-level lineage is no longer maintained by hand: it comes from the calls to
refandsource. - The column descriptions live next to the code that calculates them, and are reviewed with it.
- The governance datasheets (
governance/datasheets/) keep what the tool does not know: owner, steward, classification and retention. Thevalidate_datasheets.pyvalidator will also check that every consumption model has its datasheet.
Version control, environments and continuous integration
If transformations are code, they are managed as code.
Version control. Every change is made on a branch, proposed in a pull request and reviewed by another person before it is merged. When the change affects a glossary definition, the review includes its steward: Laura approves the changes to daily_net_sales.
Environments. The same project runs against different destinations depending on a profile:
| Environment | Destination schemas | Data | Who runs it |
|---|---|---|---|
Development (dev) |
One set per person: dev_inigo_cleansed, dev_inigo_consumption |
The last 7 days of raw data | Each person, by hand |
Production (pro) |
cleansed, consumption |
All of it | Only the svc_load service account, automatically |
Nobody runs transformations in production from their laptop. Íñigo tests in his own schemas and, since ref resolves the names per environment, the same code works in both.
Continuous integration (CI). On every pull request, an automated process checks that nothing breaks before a person reviews it:
# CI workflow (illustrative syntax): it runs on every pull request
name: validate-transformations
steps:
- install: pip install -r transformations/requirements.txt
- check_datasheets: python governance/validate_datasheets.py
- compile: dbt parse # is the project consistent?
- build_and_test: >
dbt build --target ci
--select state:modified+ # only what was modified and what depends on it
--vars '{"load_date": "2026-11-18"}'The final step builds, in a temporary schema, the modified models and their dependents, and runs their tests. If someone changes orders.sql and breaks the DQ-08 reconciliation, they will know before merging the change, not at 07:00 the next day.
ADR-009: ELT with versioned SQL transformations
ADR-009: ELT with versioned SQL transformations and tests as the
implementation of the quality rules
Status: accepted Date: 2026-11-30
CONTEXT
ADR-002 requires keeping the raw data and ADR-003 places the platform in
the cloud, with elastic compute. RQ-11 requires each metric to be
implemented in a single place. The data team is two people (RQ-13) and the
stewards read SQL, not Python. Choosing a tool for the quality rules was
still an open item (lesson 03-03).
DECISION
1. ELT approach (EtLT): ingestion writes to raw with no business
transformations; every business transformation is done on the
analytical engine.
2. Transformations are SQL models managed with a dbt-style tool
(reference: dbt Core), in datacorp-data/transformations.
3. Layers: raw (external tables) -> cleansed -> intermediate ->
consumption. Each layer reads only from the previous one.
4. Rules DQ-01 to DQ-05 and DQ-08 to DQ-12 are implemented as tests of
the project; the ingestion ones (DQ-06, DQ-07) stay in Python.
Blocking = error; warning = warn; quarantine = model <entity>_quarantine.
5. Every change goes through a pull request, review and continuous
integration. Environments dev (schemas per person) and pro (svc_load only).
6. Every run receives the load date as a parameter.
ALTERNATIVES CONSIDERED
A. ETL in Python (pandas). Rejected as the norm: logic that is opaque to
the stewards and an intermediate engine to operate. Allowed for
whatever is not SQL.
B. Loose SQL scripts run in order. Rejected: no dependencies, tests or
environments; it is the starting situation.
C. Great Expectations or Soda for quality. Deferred: the tests of the
transformation tool cover the current rules with one less component.
To be reconsidered if profiling or anomaly detection is needed.
CONSEQUENCES
Positive: readable, reviewable logic; full reprocessing from the raw data;
generated lineage and documentation; quality next to the code.
Negative: the raw zone contains personal data and requires the access
control of ADR-006; the cost of transformation falls on the analytical
engine.
Follow-up work: define the external tables; the specific adapter of the
tool depends on the analytical engine (Module 6).Common Mistakes and Tips
- Confusing ELT with "not transforming". The raw data is not queried for reports. ELT moves the transformation; it does not remove it.
- Consumption models that read from the raw data. They skip deduplication and validation, and they duplicate logic. Respect the order of the layers.
- Writing table names by hand instead of using
ref. The model works, but it disappears from the graph: it will run in the wrong order and fail in development. - Making everything incremental from day one. A badly filtered incremental model leaves stale data without raising an error. Start with full tables.
- Using
current_datein a model. It breaks reruns. Pass the date as a variable. - Tests for
uniqueandnot_nullonly. They are necessary, but they do not catch a wrong figure. Reconciliations (DQ-08) are what protect the metrics. - Repeating the same rule in several models. The
not in ('cancelled', 'returned')filter must live in one place. At DataCorp it will rely on theis_valid_salecolumn ofref_order_status. - Tip: if a model goes over 100 lines, it is probably hiding an intermediate model that deserves a name of its own.
- Tip: write the test before fixing a defect. That way the defect cannot come back without anyone noticing.
Exercises
Exercise 1: ETL, ELT or EtLT?
Reason out which approach you would apply in each case:
- A hospital must remove the patients' names before the data leaves its data center for the analytical platform in the cloud.
- The free-text description of the tickets must be classified by reason with a language model (UC-05).
- DataCorp's marketing campaign data, which arrives as CSV and JSON.
Exercise 2: Writing a model
Write the daily_net_sales model (materialized as a table) from fact_sales, dim_date, dim_customer and dim_product, with the columns sales_date, category, city, num_orders, units and net_sales. Base it on the UC-01 query of lesson 02-05.
Exercise 3: Declaring tests
Write the YAML fragment with the tests for the cleansed orders model that implement DQ-01, DQ-02 and DQ-03, and state what severity each one would have. Why should the DQ-03 test never fail on that model, and why is it worth keeping anyway?
Solutions
Exercise 1
- ETL, or EtLT with the anonymization before loading. A legal obligation prevents the original data from reaching the destination: that transformation cannot be postponed. The rest of the logic can still be done in the destination.
- Outside SQL. The classification cannot be expressed in SQL: it is done with a Python process that reads the cleansed tickets and writes the reason as a new column. The rest of the ticket processing is still ELT. This is the case that ADR-009 allows in its alternative A.
- ELT. It is stored as is in the raw zone and cleansed with SQL. Nothing prevents loading it, and all of its logic is tabular.
Exercise 2
-- models/consumption/daily_net_sales.sql
{{ config(materialized='table') }}
select
d.full_date as sales_date,
p.category,
c.city,
count(distinct s.order_id) as num_orders,
sum(s.quantity) as units,
round(sum(s.net_amount), 2) as net_sales
from {{ ref('fact_sales') }} s
join {{ ref('dim_date') }} d on d.date_sk = s.date_sk
join {{ ref('dim_customer') }} c on c.customer_sk = s.customer_sk
join {{ ref('dim_product') }} p on p.product_sk = s.product_sk
where s.order_status not in ('cancelled', 'returned') -- definition of net sales
group by d.full_date, p.category, c.cityCompared with the original query, the month filter disappears (the table contains the whole history) and so does the order by (a table has no order). Here plain joins are correct: the keys 0 of the "Unknown" members exist in the dimensions, so no row is lost. Tip: since it is a full table, it is recalculated in full every night; a return from 40 days ago corrects the figure for its day on its own.
Exercise 3
models:
- name: orders
columns:
- name: order_id
data_tests:
- unique: # DQ-01, blocking
config: {severity: error}
- not_null
- name: customer_id
data_tests:
- not_null: # DQ-02, blocking
config: {severity: error}
- name: order_date
data_tests: [not_null]
- name: total_amount
data_tests: [not_null]
- name: status
data_tests:
- accepted_values: # DQ-03
values: ['pending', 'paid', 'shipped',
'delivered', 'cancelled', 'returned'](The default severity is error, so stating it is not mandatory.) The DQ-03 test should not fail because the model itself filters out the statuses that are not allowed with the join to ref_order_status; the incorrect rows are in orders_quarantine. It is worth keeping as a safety net: if someone adds a status to the reference table without updating the list, or removes the join by mistake, the test gives it away. Tests also protect against future changes to the code, not just against faulty data.
Conclusion
ELT reverses the order of the last two phases: you load first and transform afterwards, inside the destination. It is made possible by elastic compute, the separation of storage and compute and the decision to keep the raw data, and its greatest advantage is that transformation stops being irreversible and opaque: it is SQL that can be rerun over the whole history and that is read by the people who define the metrics. In practice it is applied as EtLT, with a minimal technical transformation before loading. Transformations are organized in layers (raw, cleansed, intermediate and consumption) and managed with a dbt-style tool: models that are a SELECT, references that form a dependency graph, materializations that range from the view to the incremental table, tests that implement the DQ rules, generated documentation and lineage, separate environments and continuous integration. ADR-009 adopts it for DataCorp.
So far we have talked about loads that run once every night. But not all of DataCorp's data can wait that long: the stockout alert needs stock levels that are 15 minutes old at most, and the clickstream, an hour. Does that mean the data has to be processed "in real time"? What exactly does that expression mean, and how much does it cost? The next lesson compares batch processing with stream processing.
