Data Pipelines, Streaming & dbt
Kafka, Airflow, and the Transformation Layer
Data doesn't magically appear in a dashboard. It flows through a carefully orchestrated **Pipeline**: ingested by **Apache Kafka**, transformed by **dbt** (data build tool), and orchestrated by **Apache Airflow**. For **Walmart**, this is how millions of IoT sensor readings become a clean, queryable inventory report. For **Visa**, it's how raw transaction streams become real-time fraud scores.
In this chapter, we explore the ETL vs. ELT debate, build a streaming pipeline with Kafka, create modular SQL transformations with dbt, and orchestrate the entire flow with Airflow DAGs.
Kafka: Real-Time Streaming Ingestion
**Apache Kafka** is a distributed event streaming platform. For **Walmart**, Kafka ingests millions of IoT sensor pulses per second from trucks, warehouses, and stores. For **Netflix**, it captures every click, hover, and play event in real-time. Kafka acts as the "nervous system" of the modern data stack.
dbt: The Transformation Layer
**dbt (data build tool)** transforms raw data inside your warehouse using modular, version-controlled SQL. For **Visa**, dbt models take raw transaction logs and create clean "marts" (business-ready tables). The power of dbt is its **Lineage Graph**: you can see exactly how every table was derived, making auditing transparent.
Airflow: Orchestrating the Pipeline
**Apache Airflow** is the scheduler that ties everything together. It uses **DAGs (Directed Acyclic Graphs)** to define task dependencies: "First ingest from Kafka, then run dbt transformations, then trigger the ML model refresh." For **Walmart**, Airflow ensures the morning inventory report is always built from the freshest data.
Practice Questions
Question 1
Why is Kafka described as the 'nervous system' of modern data architecture?
Question 2
What is the primary benefit of dbt's lineage graph?