This lesson on ETL vs ELT — Why ELT Won is hands-on and example-driven. You will evaluate and select between ETL and ELT architectures based on compliance requirements, query latency, and compute costs. You will also implement in-warehouse transformation patterns using modern cloud data warehouse capabilities.
What You'll Be Able To Do
- Differentiate ETL and ELT architectures by mapping transformation boundaries to system components.
- Evaluate project requirements to choose between ETL pre-load scrubbing and ELT raw-load flexibility.
- Architect raw data staging layers inside cloud warehouses like Snowflake and BigQuery to enable ELT pipelines.
- Construct in-warehouse SQL transformation steps for hybrid ELT data modeling workflows.
Detailed Concept Walkthrough
1. Order of Operations: ETL vs ELT
The defining distinction between ETL and ELT is the physical location and timing of the transformation phase relative to data loading. ETL transforms data on dedicated intermediate compute before loading, whereas ELT loads raw data directly into the target warehouse before executing transformations.
- Execution Flow: In ETL, an external processing engine extracts data from sources, applies cleaning, enrichment, and schema validation in flight, and loads only the final curated dataset into the destination. In ELT, raw records are ingested directly into warehouse staging tables with minimal to no alteration.
- Under the Hood: Traditional ETL requires separate pipeline infrastructure (e.g., custom batch servers) that limits throughput based on server memory and network I/O. ELT offloads compute-heavy transformations to the massively parallel processing (MPP) engines inside modern warehouses.
- Best Practice: Use ELT by default for analytics ingestion to preserve raw source data lineage, enabling downstream consumers to re-parse historical records without re-extracting from transactional sources.
-- ELT Step 1: Ingest raw JSON payload directly into staging table
CREATE OR REPLACE TABLE raw_sales_events (
raw_payload VARIANT,
ingested_at TIMESTAMP_NTZ DEFAULT CURRENT_TIMESTAMP()
);
-- ELT Step 2: Transform in-warehouse using SQL
CREATE OR REPLACE TABLE analytics.fct_sales AS
SELECT
raw_payload:order_id::STRING AS order_id,
raw_payload:customer_id::INTEGER AS customer_id,
raw_payload:amount::DECIMAL(10, 2) AS total_amount,
ingested_at
FROM raw_sales_events;
Key Takeaway: ELT decouples extraction from transformation by landing raw records first, making pipeline logic fully re-executable within the target warehouse.
2. Cloud Warehouses as Compute Engines
Modern cloud data platforms decoupled storage from compute, eliminating the hardware bottlenecks that historically made in-database transformation impractical. Warehouses are now elastic compute engines designed to execute large-scale distributed SQL transformations over vast object storage.
- Mechanism: Platforms like Snowflake and BigQuery separate cheap, virtually infinite cloud storage from scalable virtual compute clusters. This allows data teams to spin up dedicated compute clusters specifically for running transformation jobs without impacting concurrent analytics queries.
- Under the Hood: Storage is persisted in shared, cost-effective columnar storage tiers, while compute queries execute across stateless worker nodes in parallel. Resources can scale up for massive transformation jobs and scale down or suspend immediately after execution.
- Best Practice: Isolate ELT transformation workloads onto separate virtual warehouses from BI/reporting workloads to prevent compute resource contention.
-- Snowflake: Scale up a dedicated transformation warehouse, execute transformation, scale down
ALTER WAREHOUSE transformation_wh SET WAREHOUSE_SIZE = 'XLARGE';
-- Run heavy aggregation transformation
INSERT INTO analytics.monthly_customer_aggregates
SELECT customer_id, DATE_TRUNC('month', ingested_at) AS report_month, SUM(total_amount) AS ltv
FROM analytics.fct_sales
GROUP BY 1, 2;
ALTER WAREHOUSE transformation_wh SET WAREHOUSE_SIZE = 'XSMALL';
Key Takeaway: Separation of compute and storage allows on-demand elasticity, turning cloud warehouses into cost-effective transformation engines.
3. Strategic Selection and Compliance Trade-offs
Choosing between ETL and ELT requires balancing analytics agility against regulatory and privacy constraints. While ELT is the modern standard for general analytics, ETL remains mandatory when sensitive data must be sanitized before landing in accessible storage.
- Regulatory Scrubbing: Highly regulated domains subject to HIPAA or GDPR often require PII, PHI, or PCI data to be masked, tokenized, or anonymized prior to persistent storage. In these scenarios, a pre-load ETL pipeline prevents raw sensitive attributes from ever entering warehouse storage layers.
- Analytics Agility: For fast-iterating product teams, machine learning, and business intelligence, ELT prevents data engineering bottlenecks. Analysts and data scientists can modify business logic directly in SQL rather than requesting pipeline code changes from platform engineers.
- Best Practice: Implement ETL for strict edge-case compliance boundaries and ELT for scalable, flexible business intelligence data pipelines.
# Python ETL: Pre-load sanitization script using hashlib before loading to warehouse
import hashlib
def sanitize_record(raw_record: dict) -> dict:
# Mask sensitive PII before persistence
raw_record["email"] = hashlib.sha256(raw_record["email"].encode()).hexdigest()
raw_record.pop("social_security_number", None)
return raw_record
Key Takeaway: Use ETL when strict privacy regulations require pre-load anonymization, but use ELT for maximum speed and downstream schema flexibility.
4. The Modern Hybrid Pattern
Real-world data architectures frequently implement a hybrid pattern where ingestion follows an ELT pattern to land raw data, followed by structured, multi-tier SQL transformations within the warehouse.
- Execution Flow: Raw data is extracted and loaded directly into landing tables with minimal schema enforcement. Once inside, transformation layers process raw tables into normalized staging views, intermediate business logic tables, and production-ready marts.
- Under the Hood: This approach maintains full data lineage and auditability while standardizing data modeling inside the warehouse SQL engine using orchestration tools or data build tools.
- Best Practice: Structure in-warehouse layers into strict zones (e.g., Raw/Bronze, Staged/Silver, Marts/Gold) to maintain lineage and control access permissions across datasets.
-- Hybrid Step: Staged transformation creating a production dimension mart
CREATE OR REPLACE TABLE marts.dim_customers AS
WITH cleaned_source AS (
SELECT
id AS customer_id,
LOWER(TRIM(email)) AS email,
created_at
FROM raw.customers
)
SELECT
customer_id,
email,
created_at,
CURRENT_TIMESTAMP() AS dwh_updated_at
FROM cleaned_source;
Key Takeaway: A hybrid pattern combines fast raw ELT ingestion with disciplined, multi-tiered SQL modeling inside the warehouse.
Topics Covered in ETL vs ELT — Why ELT Won
- ETL and ELT Definitions (0:36 - 2:05) — Compares traditional ETL transformation on separate servers with modern ELT transformation inside target warehouses.
- Pipeline Workflow Contrasts (2:06 - 3:10) — Walks through sales data ingestion to illustrate rigid ETL batch jobs versus flexible raw ELT loading.
- Cloud Warehouse Drivers (3:11 - 4:17) — Explains how decoupled storage and compute in modern cloud platforms make in-warehouse transformations cost-effective.
- Strategic Selection Criteria (4:18 - 5:43) — Identifies compliance rules that require ETL data scrubbing versus business scenarios that benefit from ELT agility.
- Modern Data Stack and Hybrid Approaches (5:44 - 7:04) — Examines the combination of ELT ingestion with in-warehouse SQL modeling layers and future trends like Zero ETL.
Data Engineering Cheat Sheet
-
ELT Pattern— Loads raw data directly into warehouse before executing SQL transformationsCOPY INTO raw.events FROM @s3_stage FILE_FORMAT = (TYPE = JSON); -
ETL Pattern— Transforms and cleans data on external compute prior to warehouse loadingtransformed_df.write.mode('append').jdbc(warehouse_url, 'fct_sales') -
In-Warehouse Staging— Extracts schema from raw variant columns into structured tablesSELECT payload:user_id::INT AS uid FROM raw_staging_table; -
Compute Elasticity— Scales dedicated transformation cluster without affecting concurrent queriesALTER WAREHOUSE etl_wh SET WAREHOUSE_SIZE = 'MEDIUM'; -
Pre-load Masking— Anonymizes sensitive fields in Python before loading to target destinationrecord['ssn'] = 'XXX-XX-' + record['ssn'][-4:]
Comparison Table
| Dimension | Traditional ETL | Modern ELT |
|---|---|---|
| Transformation Location | External processing server | Inside target data warehouse |
| Compute Engine | Dedicated batch engine (e.g. Spark) | Elastic cloud warehouse (e.g. Snowflake) |
| Raw Data Storage | Discarded or stored in separate logs | Persisted in warehouse staging tables |
| Schema Flexibility | Rigid schema defined prior to load | Flexible schema defined on read/transform |
| Regulatory Compliance | Scrubbing occurs before landing | Requires in-warehouse access governance |
Common Pitfalls
- Mistake: Loading unmasked PII into ELT staging tables in regulated environments. Avoid: Sanitizing sensitive fields before warehouse ingestion using lightweight pre-load ETL steps.
- Mistake: Running heavy transformation queries on user-facing BI compute clusters. Avoid: Allocating isolated virtual warehouses for ELT data modeling jobs.
- Mistake: Over-transforming data during the initial extraction and loading phase. Avoid: Landing raw immutable data first to retain re-processing capabilities.
FAQs
- Why was ETL preferred over ELT before cloud data warehouses? Legacy on-premise relational databases had constrained compute and storage resources. Running heavy transformations directly on production warehouses risked performance degradation for reporting.
- What core technical innovation enabled the shift to ELT? The separation of storage and compute in cloud data warehouses made storage cheap and allowed independent, on-demand compute scaling for transformation workloads.
- When is ETL still the preferred architecture over ELT? ETL is required when strict regulations (like HIPAA or GDPR) prohibit storing raw sensitive or unmasked PII data in the central data warehouse.
- What is Zero ETL? Zero ETL refers to tightly integrated cloud platform architectures that replicate data from transactional databases to analytical platforms automatically without manual pipeline development.