Unit 2 Cloud Pipelines Notes

Unit 2 — Understanding the Data Pipeline Workflow | DataSoSi
Cloud Data Pipelines · Unit 2 of 12 · Foundations

Understanding the Data Pipeline Workflow

Learn how data moves from a raw, messy file through validation, cleaning, and transformation before becoming a reliable output that businesses can actually use.

Data rarely arrives in perfect condition. Real business files contain blank cells, inconsistent formatting, and duplicate rows. A pipeline does not just move data — it processes it at every stage, applying rules that turn unreliable raw input into clean, structured output.
4 Sections
Notes + Knowledge Check
Foundations Level
1 2 3 4 5 6 7 8 9 10 11 12

Learning Objectives

  • Explain the three states of data in a pipeline — raw, processed, and final output — and what distinguishes each
  • Identify the four common problems found in raw business data and why they must be resolved before use
  • Trace the full lifecycle of data through a pipeline: raw file, validation, cleaning, transformation, and final table
  • Run hands-on Python code in Databricks that simulates each stage of the cleaning process
  • Explain the distinct roles of Databricks and AWS Lambda within the data lifecycle
Four sections. Select individually or expand all.

Every piece of data that enters a pipeline passes through three distinct states before it is ready for business use. Understanding these states is the foundation for understanding why pipelines exist and what each component is responsible for.

1. Raw Data
The original file exactly as it arrived — no changes applied. Raw data reflects the real world, which means it contains errors. A CSV file called sales_march.csv might have blank cells where amounts are missing, dates written in different formats, and rows that appear more than once. This is the starting point.
2. Processed Data
Data that has been through the cleaning and transformation stage. Blank rows have been removed, dates standardized to a single format, column names made consistent. Databricks is responsible for this stage — it reads the raw file and applies the rules that produce clean data.
3. Final Output Data
The cleaned, structured result that is stored for downstream use. This data feeds dashboards, reports, analytics tools, and business decisions. It is reliable, consistent, and ready to be queried. A Delta table in Databricks is a common format for final output.
Common Problems in Raw Business Data
ProblemWhat It Looks LikeWhy It Causes Issues
Missing valuesA cell in the “Sales Amount” column is blankCalculations using that column will fail or produce incorrect totals
Inconsistent formattingDates written as 01/03/2024, March 1 2024, and 2024-03-01 in the same columnThe system cannot sort or filter by date reliably
Duplicate recordsThe same transaction row appears twice in the fileReports will double-count values, producing inflated figures
Incorrect data typesA numeric sales amount stored as text (“1,200” instead of 1200)Math operations will fail because the system treats the value as a word, not a number
Why You Cannot Use Raw Data Directly

Feeding raw data into a dashboard or report without cleaning it first produces unreliable results. A missing sales figure skews a total. A duplicate record inflates a count. A badly formatted date breaks a sort. The cleaning stage exists specifically to catch and correct these issues before the data reaches anyone who relies on it to make decisions.

A data pipeline is not a single step — it is a sequence of stages, each with a defined purpose. Data enters at the top as a raw file and exits at the bottom as a clean, structured table. Every stage either checks the data, changes it, or moves it forward.

RAW
Raw File
The original file arrives — a CSV, Excel sheet, or log file. It contains everything the source system produced, including all errors and inconsistencies.
↓
VAL
Validation
The pipeline checks whether the file meets basic expectations. Does it have the right columns? Is it in the expected format? Files that fail validation are flagged before any processing begins.
↓
CLN
Cleaning
Blank rows are removed. Duplicates are dropped. Dates are standardized. Column names are made consistent. Databricks runs the notebook code that performs all of these operations.
↓
TRN
Transformation
The cleaned data is reshaped for its intended use. New columns may be calculated (total revenue = quantity × price). Data may be grouped, filtered, or joined with other sources.
↓
OUT
Final Table
The result is written to a Delta table or structured output. Dashboards, reports, and analysts read from this clean, reliable source.
Role of Each Tool in the Lifecycle
Databricks — The Processing Engine
Databricks is responsible for everything that happens to the data itself — reading, validating, cleaning, transforming, and writing the output. The notebook code you write defines the rules that govern each of these steps.
AWS Lambda — The Transition Trigger
Lambda does not touch the data. Its role is to detect that a new file has arrived and start the Databricks workflow automatically. Without Lambda, someone would need to manually trigger the notebook every time a file appears.
A Useful Analogy

Think of Lambda as a smoke detector and Databricks as the fire suppression system. The smoke detector does not put out the fire — it detects the event and activates the system that does. Lambda detects the file and activates Databricks. Each tool has one job, and together they produce a fully automated response.

Open your Databricks notebook from Unit 1 or create a new one named Unit2_Pipeline_Lifecycle. You will run three cells in sequence, each representing one stage of the pipeline.

Cell 1 — Create Sample Raw Data
Python Cell 1 — Raw Data with a Missing Value
data = [
    [“Alice”, 500],
    [“Bob”, None],
    [“Charlie”, 700]
]

print(data)
Expected Output
[[‘Alice’, 500], [‘Bob’, None], [‘Charlie’, 700]]
Line-by-Line Explanation

data = […] creates a variable called data that holds a list. Each item inside the list is itself a list representing one row — a name and a sales amount. None is Python’s way of representing a missing value. Bob’s sales figure does not exist. This is the raw state: real data, real problem. The print statement displays the full list so you can see the missing value before any cleaning happens.

Cell 2 — Simulate Cleaning
Python Cell 2 — Remove Rows with Missing Values
clean_data = []

for row in data:
    if row[1] is not None:
        clean_data.append(row)

print(clean_data)
Expected Output
[[‘Alice’, 500], [‘Charlie’, 700]]
Line-by-Line Explanation

clean_data = [] creates an empty list that will hold only the valid rows after cleaning. for row in data: loops through every row in the original data list one at a time. if row[1] is not None: checks whether the second item in that row (the sales amount, at position 1) is a real value rather than a missing one. If the value exists, clean_data.append(row) adds that row to the clean list. Bob’s row fails the check — his amount is None — so it is skipped. Alice and Charlie pass, so they are included. The result is a cleaned dataset with no missing values.

Cell 3 — Confirm Final Output
Python Cell 3 — Final Output Confirmation
print(“Final cleaned table created”)
Expected Output
Final cleaned table created
What This Represents

In a real pipeline, this final step would write the clean_data to a Delta table stored in Databricks — a permanent, queryable output. For now, the print statement confirms that the pipeline has completed its processing. In later units, you will replace this confirmation message with an actual write command that saves the clean data to a table.

What You Just Simulated

These three cells represent the core logic of a data pipeline in miniature: create raw data with a problem, apply a cleaning rule that removes the problem, and confirm that clean output has been produced. Every real pipeline follows this same pattern — just at much larger scale and with many more rules.

Data quality is not a technical concern — it is a business concern. Every decision made from a dashboard, every report sent to leadership, and every forecast produced by an analytics team depends on the reliability of the data underneath it. When that data is raw and uncleaned, the decisions built on it are unreliable.

What Poor Data Quality Costs
Incorrect Reporting
A duplicate row in a sales file causes the total revenue figure to be overstated. Leadership makes resource allocation decisions based on a number that is simply wrong. The error is invisible until someone manually audits the data.
Failed Analysis
An analyst tries to calculate average transaction value but the amount column contains text values mixed with numbers. The calculation fails or produces nonsense. The analyst must stop, trace the problem, fix the data, and rerun — losing hours of work.
Compliance Risk
In regulated industries — finance, healthcare, government — data records must be accurate and auditable. Missing or inconsistent records can create compliance failures. An automated pipeline with documented cleaning rules provides an audit trail that manual processes cannot.
Why Automation Improves Consistency

When a person cleans data manually, the rules they apply depend on their interpretation, their attention level, and their availability. Two analysts following the same instructions will produce slightly different results. An automated pipeline applies exactly the same rules every single time — no variation, no fatigue, no missed steps.

Reflection Prompt

Think of a situation in your own work or studies where you have relied on a report, a table, or a data summary to make a decision. How would that decision have changed if the underlying data contained missing values or duplicates? What would it have taken to catch the error before the decision was made?

Knowledge Check

Five questions covering the key concepts from Unit 2. Select the best answer for each question.

1. What is the correct order of stages in the data pipeline lifecycle covered in this unit?

2. In the cleaning code from this unit, what does if row[1] is not None check for?

3. What is the role of AWS Lambda in the data lifecycle?

4. Which of the following best describes “processed data” in the three-state model?

5. Why does automated cleaning produce more consistent results than manual cleaning?

Unit 2 Summary

What you covered in this unit

Three Data States

Raw data has problems. Processed data has been cleaned. Final output data is reliable and ready for business use.

Pipeline Lifecycle

Data passes through five stages: raw file, validation, cleaning, transformation, and final table. Each stage has a defined purpose.

Databricks Role

Databricks reads, cleans, and transforms the data. The notebook code defines the rules applied at each processing stage.

Lambda Role

Lambda detects that a new file has arrived and triggers the Databricks workflow. It moves data between stages — it does not process data itself.

Raw Data Processed Data Final Output Validation Cleaning Transformation None (Python) Missing Values Delta Table Data Quality