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.

PythonRuns entirely in your browser — nothing is sent to a server.

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.

PythonRuns entirely in your browser — nothing is sent to a server.

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.

PythonRuns entirely in your browser — nothing is sent to a server.

Practice Questions

Question 1

Why is Kafka described as the 'nervous system' of modern data architecture?

  • Because it stores data permanently
  • Because it acts as the real-time event backbone, ingesting and distributing millions of events per second to downstream consumers
  • Because it only works with Netflix
  • Because it replaces the need for a database

Question 2

What is the primary benefit of dbt's lineage graph?

  • It makes SQL queries colorful
  • It provides complete transparency into how every table was derived, enabling auditing and impact analysis
  • It speeds up query execution
  • It replaces the need for Kafka