Data Pipelines 101: A Beginner’s Complete Guide to Moving, Transforming, and Trusting Your Data
“Water does not flow uphill — but data does not flow anywhere without a pipeline.”
Build the pipeline, and your data goes exactly where it needs to.
Introduction: Where Does Your Data Actually Come From?
Every dashboard your CEO looks at, every ML model your team trains, every report your analyst presents — all of it started somewhere else. A database, an API, a CSV uploaded by someone in operations, a stream of clickstream events from your website.
Before any of that data became useful, something moved it, cleaned it, transformed it, and loaded it into the right place. That something is a data pipeline.
Data pipelines are the infrastructure of modern data work. They are not glamorous. They rarely appear in conference talks. But they are what makes everything else possible — and their absence is what causes most of the chaos in data teams that are “drowning in data but starving for insight.”
This guide covers the complete picture: what data pipelines are, why you need them, how they work, the different types, the tools that build them, and how to think about them as a data scientist.
Part 1: What Is a Data Pipeline?
A data pipeline is an automated sequence of steps that moves data from one or more sources to one or more destinations, transforming it along the way.
Source(s) → Extract → Transform → Load → Destination(s)Source: Where data comes from. A PostgreSQL database, a REST API, a CSV on S3, a Kafka event stream, a Google Analytics export.
Extract: Pulling the data from the source — querying a database, calling an API endpoint, reading a file.
Transform: Cleaning, reshaping, enriching, aggregating, and validating the data — making it useful.
Load: Writing the processed data to its destination — a data warehouse, a feature store, a dashboard, another database, a machine learning model.
This pattern is so fundamental it has a name: ETL (Extract, Transform, Load). A variant flips the T and L — loading raw data first, then transforming it inside the destination — called ELT, which is how most modern cloud data warehouses operate.
ETL: Extract → Transform → Load
Transform happens outside the destination (e.g., in Python or Spark)
ELT: Extract → Load → Transform
Raw data lands in the warehouse first, transformation happens inside it (SQL)
Used by: dbt, Snowflake, BigQuery, RedshiftPart 2: Why Data Pipelines Exist — The Alternatives Are Worse
Before pipelines, data movement was manual. An analyst exported a CSV from the database every Monday, opened it in Excel, cleaned it, added columns, and emailed it to stakeholders. This worked until:
- The analyst was on holiday
- The CSV format changed
- Someone made an error in the manual cleaning step
- The data grew too large for Excel
- Two analysts applied slightly different cleaning logic and produced different numbers
Data pipelines automate what was manual, standardise what was inconsistent, and scale what could not grow. The benefits:
Manual data work Data pipeline equivalent
──────────────────────────────────────────────────────────────────────
Monthly exports Scheduled daily/hourly/real-time refresh
Excel cleaning Reproducible code, version-controlled
Email distribution Automatic delivery to dashboard/warehouse
Human memory of steps Documented, auditable transformation logic
One analyst's process Team-shared, consistent, trustworthyPart 3: Types of Data Pipelines
Not all pipelines are the same. The right type depends on how fast you need the data and how it will be used.
Batch Pipelines
Process data in chunks at scheduled intervals. The most common type.
Schedule: daily, weekly, hourly
Trigger: clock (run at 2 AM every night)
Latency: hours to days (data is delayed by the batch frequency)
Best for:
Nightly reporting
Weekly model retraining
End-of-month financial summaries
Daily feature generation for MLStreaming Pipelines
Process data continuously as it arrives, in real time or near-real time.
Schedule: always running
Trigger: event (a new transaction, a user click, a sensor reading)
Latency: milliseconds to seconds
Best for:
Fraud detection (must flag suspicious transactions immediately)
Real-time recommendation engines
IoT sensor monitoring
Live dashboardsMicro-batch Pipelines
A hybrid — process data in very small batches every few minutes. Simpler than streaming, lower latency than batch.
Schedule: every 5–15 minutes
Best for: near-real-time use cases that do not need true millisecond latencyPart 4: The Core Components of a Data Pipeline
4.1 Extraction
Extracting data means connecting to a source and pulling records. The complexity depends on the source:
# Extract from a PostgreSQL database
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine("postgresql://user:password@host:5432/prod_db")
df = pd.read_sql("SELECT * FROM transactions WHERE date >= '2024-01-01'", engine)
# Extract from a REST API
import requests
response = requests.get(
"https://api.example.com/v1/orders",
headers={"Authorization": "Bearer token123"},
params={"page": 1, "limit": 1000}
)
orders = response.json()["data"]
# Extract from S3
import boto3
import io
s3 = boto3.client('s3')
obj = s3.get_object(Bucket='my-data-bucket', Key='raw/customers/2024-04.csv')
df = pd.read_csv(io.BytesIO(obj['Body'].read()))Incremental extraction is critical for performance. Instead of pulling all historical data every time, pull only what has changed since the last run:
# Incremental extraction — only new records
last_run_timestamp = get_last_run_timestamp() # stored in a metadata table
df = pd.read_sql(f"""
SELECT * FROM transactions
WHERE updated_at > '{last_run_timestamp}'
""", engine)4.2 Transformation
Transformation is where the data becomes useful. Common operations:
import pandas as pd
import numpy as np
# Clean column names
df.columns = df.columns.str.lower().str.replace(' ', '_')
# Handle missing values
df['revenue'].fillna(0, inplace=True)
df['category'].fillna('unknown', inplace=True)
# Parse dates
df['transaction_date'] = pd.to_datetime(df['transaction_date'])
df['year_month'] = df['transaction_date'].dt.to_period('M')
# Derive new columns
df['order_value_usd'] = df['order_value_inr'] / 83.5
df['is_high_value'] = (df['order_value_usd'] > 500).astype(int)
# Aggregate
monthly_revenue = df.groupby('year_month').agg(
total_revenue = ('order_value_usd', 'sum'),
num_orders = ('order_id', 'count'),
unique_customers = ('customer_id', 'nunique')
).reset_index()dbt (data build tool) is the standard for transformation in modern ELT stacks — it lets you write SQL transformations as version-controlled models:
-- models/marts/monthly_revenue.sql
SELECT
DATE_TRUNC('month', transaction_date) AS month,
SUM(order_value_usd) AS total_revenue,
COUNT(DISTINCT customer_id) AS unique_customers
FROM {{ ref('stg_transactions') }}
GROUP BY 14.3 Loading
Write the transformed data to its destination:
# Load to PostgreSQL
monthly_revenue.to_sql('monthly_revenue', engine, if_exists='replace', index=False)
# Load to S3 as Parquet (preferred format for analytical use)
monthly_revenue.to_parquet("s3://my-bucket/processed/monthly_revenue/2024.parquet")
# Load to BigQuery
from google.cloud import bigquery
client = bigquery.Client()
client.load_table_from_dataframe(monthly_revenue, "project.dataset.monthly_revenue")Part 5: Orchestration — Managing When and How Pipelines Run
A pipeline is a sequence of tasks. An orchestrator manages scheduling, dependencies, retries on failure, logging, and monitoring across all tasks.
Get R_Talks’s stories in your inbox
Join Medium for free to get updates from this writer.
Apache Airflow is the most widely used orchestrator — it models pipelines as DAGs (Directed Acyclic Graphs):
from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime
with DAG("daily_sales_pipeline",
schedule_interval="0 2 * * *", # Run at 2 AM every day
start_date=datetime(2024, 1, 1)) as dag:
extract = PythonOperator(task_id="extract", python_callable=extract_data)
transform = PythonOperator(task_id="transform", python_callable=transform_data)
load = PythonOperator(task_id="load", python_callable=load_data)
extract >> transform >> load # Define dependency orderPrefect (simpler, Python-native), Dagster (data-aware orchestration), and Mage (notebook-style pipelines) are modern alternatives.
Part 6: Data Quality Monitoring — Trusting What Flows Through
A pipeline that runs without errors but produces wrong data is worse than a pipeline that fails loudly. Data quality checks catch silent failures.
# Great Expectations — data quality library
import great_expectations as gx
context = gx.get_context()
validator = context.sources.pandas_default.read_dataframe(df)
# Define expectations
validator.expect_column_to_exist("customer_id")
validator.expect_column_values_to_not_be_null("revenue")
validator.expect_column_values_to_be_between("revenue", min_value=0, max_value=1_000_000)
validator.expect_column_values_to_be_unique("transaction_id")
results = validator.validate()
if not results["success"]:
raise ValueError("Data quality checks failed — stopping pipeline")Key metrics to monitor in every pipeline:
Row count: today_count / yesterday_count — sudden drop or spike flags issues
Null rate: nulls / total rows per column — should be stable over time
Freshness: max(updated_at) should be within expected recency
Schema drift: column count and types should match expected schema
Value distribution: statistical shifts in key columns (PSI > 0.25 → investigate)Population Stability Index (PSI) for distribution monitoring:
PSI = Σ (Actual% − Expected%) × ln(Actual% / Expected%)PSI < 0.10 → Stable, no concern
PSI 0.10–0.25 → Moderate shift, monitor
PSI > 0.25 → Significant drift, investigate pipelinePart 7: Tools at a Glance
Category Tool Best For
───────────────────────────────────────────────────────────────────────
Orchestration Apache Airflow Enterprise, complex DAGs
Prefect Simpler setup, Python-native
Dagster Data-aware, asset-based orchestration
Transformation dbt SQL transformations in ELT stacks
pandas / Spark Python-based, large scale
Streaming Apache Kafka High-volume event streams
Flink / Spark Streaming Stateful stream processing
Data Quality Great Expectations Python-native, rich validation
dbt tests SQL-based quality checks built into dbt
Storage Snowflake, BigQuery, Redshift Cloud data warehouses
S3, GCS, Azure Blob Raw data lake storage
Delta Lake, Iceberg ACID-compliant data lake tablesConclusion: The Pipeline Is the Foundation
Every insight, every model, every report your organisation relies on starts with data that moved from somewhere to somewhere else. The pipeline is that movement — and whether that movement is reliable, timely, and trustworthy determines whether your data work creates value or creates chaos.
Start with a simple batch pipeline in Python and schedule it with Prefect. Add dbt for SQL transformations. Add Great Expectations for quality checks. As your needs grow, add Airflow for complex orchestration and Kafka for streaming.
You do not need to build everything at once. But you need to start somewhere — and every pipeline you build makes the next one easier.
Found this useful? Follow for more applied data science and data engineering guides. What data are you moving manually right now that should be in a pipeline?








