A Typical Data Pipeline
Published: 2022-11-01 11:14:45

---
title: A Typical Data Pipeline
published: true
date: 2022-11-01 06:33:02 UTC
tags: 
canonical_url: https://maninekkalapudi.com/a-typical-data-pipeline
---

# **Introduction**

Hello people, Hope you are doing well.

As data engineers, we build data pipelines to collect data from different source systems and place it in an analytics system i.e., a data warehouse/data lake. The data is usually sourced systems like a database, web events, or an API and etc.

**_In this post, we will talk about_**

1. What is a data pipeline?
2. Stages of a data pipeline
3. What is ETL and ELT?
4. What is the difference between data warehouse and data lake?
5. Why do we need a data pipeline?

## 1. **_What is a data pipeline?_**

We know that a data pipeline collects data from different source systems and moves it to the analytics system. Let's improvise that definition a bit

**_A data pipeline is a series of interconnected systems that passes data in only one direction, i.e., from source to serving layer with increasing order of clarity and value in the data_**

The data received from a source may contain duplicate records, test records and records that are problematic. Data pipeline should be designed in such a way that it eliminates all these issues and only then is the data moved from raw to staging to serving thus increasing the clarity and value in it

## 2. Stages of a data pipeline

A typical data pipeline will have the stages below (refer above picture).

1. Sources
2. Raw
3. Staging
4. Serving

The below picture shows the different stages of a data pipeline

![Untitled.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1667283797078/bcbdThrWT.png)

1. **_Data Sources_** : Where data is generated, recorded or obtained for the data pipeline. For example, a database, an SFTP file server, an API and etc. 

2. **_Raw layer_** : It is the first level of data storage in the data warehouse. This is an archival storage layer and the data stored in it will not be modified at any time.

3. **_Staging/Transform layer_** - It is the second level of data storage in the data warehouse. The data in this layer, which is sourced from raw layer, is cleaned, transformed into a certain format and then stored in various staging tables.

4. **_Serving layer_** : This is the aggregated data layer, and the data will be sourced from different staging tables. For example, average amount spent by the customers over the years

## 3 **. What is ETL and ELT**

ETL stands for Extract, Transform and Load. ETL/ELT is a process to get the data into an analytical system like a data warehouse or data lake, preferably on a schedule.

**_ETL_**

In ETL, the data is extracted from a source, transformed into final format and loaded into DWH table. This is well suited when the data is in a database where the data needs minimal changes.

**_ELT_**

In ELT, the data is extracted from a source, loaded into the raw layer. When the transformations are defined in the future, the data is transformed readily and loaded into the final tables in the data warehouse.

ELT is well suited when the data comes from different sources and the transformations for all the data are not defined completely. The data is transformed when they are available, and the subsequent staging table is modified accordingly.

## 4 **. What is the difference between data warehouse and data lake?**

| Data Warehouse | Data Lake |
| Stores processed data | Stores raw data |
| Transformations are fully defined | Transformations are not fully defined |
| Stores structured data in tabular format in a data warehouse tables | Stores the structured, semi-structured and unstructured data in raw form |
| More complicated and costly to make changes to the tables | Highly accessible and quick to update |
| File formats like parquet, ORC, delta and etc. are used | File formats like CSV, text files, parquet files, PDFs etc. are used |

## **4. Why do we need a data pipeline?**

Large volumes of data come in from different sources (Apps, web events, transactions, images/videos, telemetry data). These data are of different types, and sizes

These characteristics i.e., volume, variety, velocity is attributed to Big Data. To process the big data in a consistent manner while serving the data to an entire organization is a huge challenge. Data pipelines are built by data engineers to solve this problem.

Once the data is processed, it is stored in a centralized data repository like a data warehouse. This ensures that the data is not siloed and anyone with the right access can always access the data and perform the analysis.

Data pipelines can also ensure data quality at a scale. Any checks that need to be performed on the data can be applied on the transformation stage ensuring quality.

Since we also maintain the raw data, the pipelines will be made resilient of failures, any data loss or corruption can be eliminated using them by reprocessing the existing data.

Check out the video on the same topic:

{% youtube https://youtu.be/0TYxyAqPZto %}

## Resources

1. [Data Lake vs Data Warehouse: Key Differences | Talend](https://www.talend.com/resources/data-lake-vs-data-warehouse/#:~:text=Data%20lakes%20and%20data%20warehouses,processed%20for%20a%20specific%20purpose.)
2. [Databases Vs. Data Warehouses Vs. Data Lakes | MongoDB](https://www.mongodb.com/databases/data-lake-vs-data-warehouse-vs-database)