Module 01 · Lesson 1 of 11Free
Introduction to data engineering
- Level
- Beginner
- Reading time
- 12 min
When you finish this page you can
- Explain why a company’s own database can’t answer its business questions well on its own.
- Describe what a data pipeline does, step by step, for one nightly report.
- Estimate how much data a day of orders and click events adds, and what that size allows.
- Recognise the core job of data engineering: numbers that arrive on time and mean one thing.
Chapters
Show transcript
0:00 It’s seven o’clock on a Tuesday morning. Daniel works in finance at Kartly, our example online shop. He opens two reports about Monday’s sales. Marketing’s report says Kartly sold 7.2 crore rupees. His own sheet says 6.77 crore. Both teams asked the same data. Both queries ran fine. So which number is right? And why are there two? Here is the question for this lesson. How does a company turn what its apps record into numbers people can trust? That job has a name: data engineering.
0:30 Here’s how Kartly’s data is used today. The shop’s app saves every order in its main database. A read-only copy of that database, called a replica, serves anyone who wants to look at the data. Marketing, finance and product each write their own query against that copy. The gap is easy to explain. Marketing counts every order placed on Monday, even the ones customers cancelled. About 6 percent were cancelled. Finance leaves those out, because Kartly never received that money. So the two reports differ by exactly the cancelled orders. Neither query was wrong. The company just never agreed what revenue means. It’s easy to assume a report is one query away once the data sits in a database. But the data was there. What wasn’t there was one agreed definition, kept in one place. Or a copy of the data shaped for questions like this.
1:18 Kartly’s database is built for the shop’s own work. Create one order. Read one cart. Update one stock count. Small jobs, fast and correct. Daniel’s questions are the opposite. Scan a whole day, or a whole year, then add it up. One database struggles to do both well. Running reports on the copy protects checkout. But it has limits. The copy must keep applying the main database’s changes, and a long report can get in the way. Then the report can be cancelled. Or the main database has to keep old rows around for it, which makes it swell. And the copy holds only what the shop needs. Payments, refunds and click events live in other places. So where should Daniel’s report get its data? Ask the main database directly, and a slow report slows checkout during a sale. Ask the copy, and every team still writes its own definition. The better answer: each night, copy the day’s data into a separate store built for analysis. Apply one definition of revenue. Check the result. The cost is that the data is up to a day old, and someone must build and run the job. Daniel needs Monday’s numbers by morning, not to the minute. So that’s fine.
2:15 Data engineering is the work of moving data from where it’s made to where it’s used, and keeping it correct, on time and affordable. The system that does the moving is a data pipeline. Think of it as steps that read data, change it, and write it somewhere useful. At Kartly, Meera, a data engineer, builds Daniel’s pipeline. It has five parts, one job each. First, a job reads yesterday’s orders and clicks from the copy after midnight, so reports never touch the shop’s database. Then a separate store keeps every day’s copy. Next, a step builds a daily revenue table, with one definition. Then a check compares counts with the source. And a schedule runs all of it every night, so the report is ready by seven.
2:53 Before choosing any tool, Meera works out how much data moves. These sizes are estimates for this example. Orders are small, about 12 megabytes a day. Click events are the bulk, about 3 gigabytes a day. Almost all the volume is clicks, not sales. Over a year, clicks add up to about 1.1 terabytes. One machine can still store that. So Meera doesn’t need a cluster yet. The examples in this part of the course run in DuckDB. It’s a database that runs right inside a Python program, so there’s nothing to install on a server.
3:24 A pipeline runs while nobody watches, so its failures are quiet. At one in the morning, the load job starts copying Monday’s orders. Later, the copy restarts for maintenance. It stops after 31,000 of the 60,000 orders. The job saves what it has and exits without an error. At seven, the report shows about 3.5 crore rupees instead of 6.77. Daniel sends it to leadership. Kartly looks like it lost half its sales overnight. The fix is a check. The job counts Monday’s orders in the copy. It counts what it loaded. If the two differ, it refuses to publish. A late report with a clear warning beats a wrong report on time. Moving data is the easy part. The hard part is trust: numbers that show up when promised, mean one thing, and are whole.
4:08 The transform step is where revenue gets its single definition. You can see the idea in six made-up orders. One was placed after midnight, so it belongs to the next day. Of the rest, two were cancelled. One query counts every order. Another leaves out the cancelled ones. Same table, two answers, and the gap is exactly the cancelled orders. So write the definition once, and have every report read it. That avoids three common mistakes. Choosing tools before you know the question. Treating a finished job as right data. And letting each team define the same number. If revenue is defined in five dashboards, it will soon have five values.
4:44 Let’s recap. Data engineering turns the data apps produce into numbers that are correct, on time and affordable. The shop’s database is built for one order at a time, so big reports there slow the shop, or give each team its own answer. A nightly pipeline copies the data, defines each number once, checks it, and runs on a schedule. Size the data first. Here, one machine is enough for now. And pipelines fail quietly, so check what you loaded against the source. Next lesson: what happens to the data along the way? We start when a customer taps Buy, and end when Daniel reads a number. See you in The data lifecycle.
Two teams, two revenue numbers
It’s 07:00 on a Tuesday. Daniel, who leads finance reporting at , opens two reports about Monday. Marketing’s dashboard says Kartly sold ₹7.2 crore. His own spreadsheet says ₹6.77 crore.
Kartly is an online store in India. It takes about 60,000 orders a day, and its website records about 10 million click events a day: page views, searches, taps on “Add to cart”. All of it lands in the store’s PostgreSQL database and logs.
Both teams queried that same data. Both queries ran without an error. So which number is right, and why are there two?
This lesson answers one question: how does a company turn the data its apps produce into numbers people can trust and use? That work is .
Marketing and finance both added up Monday’s orders from the same database and got different totals. Before reading on, name one likely reason.Show answer
Where the two numbers came from
Here is how Kartly’s data is used today. The store’s app writes orders to a PostgreSQL primary database. A , a read-only copy kept up to date from the primary, serves anyone who wants to look at the data. Each team writes its own SQL against that replica.
Same data, same question, two answers. Neither query failed.
The gap is easy to work out once you know the definitions.
Marketing counts every order placed
60,000 orders × ₹1,200 average = ₹7.2 crore
Every order placed on Monday, including the ones customers cancelled.
About 6% of orders were cancelled
60,000 × 6% = 3,600 orders × ₹1,200 = ₹43.2 lakh
Finance leaves these out, because Kartly never received that money.
Finance counts orders that were not cancelled
₹7.2 crore − ₹43.2 lakh ≈ ₹6.77 crore
The two reports differ by exactly the cancelled orders.
The average order value and the 6% cancellation rate are this lesson’s scenario numbers.
Many engineers believe that once data is in a database, any report is one query away. The data was there. What was missing is one agreed definition, written down in one place, and a copy of the data built for questions like this.
Why the store’s database is the wrong place to ask
Kartly’s database is built for the store’s own work: create one order, read one cart, update one stock count. That is , small reads and writes that must be fast and correct. Daniel’s questions are : scan a whole day or a whole year, then add it up. OLTP vs OLAP covers why one database struggles to do both well.
Running reports on the replica protects checkout, but it has its own limits. A replica only allows reads 3. It must also keep applying the primary’s changes, and a long report can get in the way. When that happens, PostgreSQL cancels the report after a configured delay 3. The other option keeps old rows around for the report, which can bloat tables on the primary 3. Read replicas and replication lag explains the mechanism.
And even a perfect replica holds only what the store needs. Payments, refunds and click events live in different places, each shaped for the app, not for questions.
Where should Daniel’s daily revenue report get its data?
Query the primary database directly.
The report scans 60,000 orders on the same database that is taking new ones. During a festival sale, a slow report means a slow checkout, and customers leave.
Query the read replica.
Checkout is safe, and this works while reports are small. But long reports can be cancelled or bloat the primary, every team still writes its own definition of revenue, and data from other systems can’t be joined in.
Copy the data each night into a separate analytical store, and report from that.
A job copies each day’s data into a separate store built for analysis, applies one definition of revenue, and checks the result. Reports read from there. The cost: the data is up to a day old, and someone has to build and run the job.
Why this choice
Daniel needs Monday’s numbers by 07:00 on Tuesday, not to the minute. So a copy that is a few hours old costs him nothing, and it takes the reporting load off the store’s database completely. The copy can also be reshaped: cancelled orders marked, refunds joined in, revenue defined once.
The choice would change if the business needed fresher numbers. A live festival dashboard can’t wait for tonight’s copy, and that is where streaming comes in, covered in Batch vs streaming. And at a few hundred orders a day, querying the replica is fine: a nightly job is work you only take on once reports start to hurt.
What data engineering is
You have now seen the job. Data engineering is building and running the systems that move data from where it is made to where it is used, and keeping it correct, on time and affordable.
The system that does the moving is a : a series of steps that reads data from a source, changes it, and writes it somewhere useful, on a schedule or continuously. At Kartly, Meera, a data engineer on the data team, builds Daniel’s pipeline.
Each part of the pipeline does one job:
| Step | What Meera builds | What it guarantees |
|---|---|---|
| Extract and load | A job that reads yesterday’s orders and events from the replica after midnight | Reports never touch the store’s database |
| Store | An analytical database that keeps every day’s copy | History stays queryable, even after the app deletes or changes rows |
| Transform | A SQL step that builds a daily revenue table with one definition | Every team gets the same number |
| Check | A comparison of row counts and totals with the source | A broken load is caught before anyone reads it |
| Schedule | A rule that runs all of this every night, in order | The report is ready by 07:00 |
Joe Reis and Matt Housley call this path the data engineering lifecycle, with five stages: generate, store, ingest, transform and serve 2. The next lesson, The data lifecycle, walks through each stage.
A day of Kartly’s data fits on one machine
Before choosing any tool, Meera works out how much data the pipeline moves. The row sizes below are estimates for this scenario.
Orders
60,000 orders × about 200 bytes = about 12 MB a day
Small. A single order row holds ids, amounts, a status and a few timestamps.
Click events
10,000,000 events × about 300 bytes = about 3 GB a day
Clicks are 250 times as many bytes as orders. Almost all the volume is events, not sales.
A year of click events
3 GB × 365 days ≈ 1.1 TB
Still a size one machine can store, but large enough to plan for.
That turns into a decision. A few gigabytes a night fits comfortably on one machine, so Meera doesn’t need a cluster yet. The examples in this part of the course run in , an analytical database that runs inside a Python program or on a laptop, with nothing to install on a server. Growth estimates get their own lesson in Estimating data volume and growth.
When the nightly load breaks
A pipeline is software that runs while nobody watches. Its failures are quiet.
Half a day of revenue, sent to leadership
- At 01:00, the load job starts copying Monday’s orders from the replica.
- At 03:10, the replica restarts for maintenance. The copy stops after 31,000 of 60,000 orders.
- The job saves what it has and exits without an error.
- At 07:00, the report shows about ₹3.5 crore of revenue instead of ₹6.77 crore.
- Daniel sends it to leadership, and Kartly appears to have lost half its sales overnight.
The fix is the check step. The job counts Monday’s orders in the replica, counts what it loaded, and refuses to publish if they differ. A late report with a clear warning is far better than an on-time wrong one. Pipeline failures covers detection and recovery in full.
This is the core of the job. Moving data is the easy part. The hard part is that the numbers arrive on time, mean one thing, and are complete.
One definition, written once
In Meera’s pipeline, the transform step is where “revenue” gets its single definition. You can see the idea at small scale.
Try it yourself
Write Kartly’s revenue definition once, and see both teams’ numbers side by side. You need Python 3.11 or later. Install DuckDB:
pip install duckdb==2.0.0Save this as revenue.py and run python revenue.py. duckdb.sql runs each query on an in-memory database inside the Python program 4, so nothing is saved to disk.
import duckdb
# Six made-up Kartly orders. Order 1006 was placed after midnight.
duckdb.sql("""
CREATE TABLE orders AS
SELECT * FROM (VALUES
(1001, DATE '2026-11-09', 1200, 'delivered'),
(1002, DATE '2026-11-09', 800, 'cancelled'),
(1003, DATE '2026-11-09', 2500, 'shipped'),
(1004, DATE '2026-11-09', 450, 'delivered'),
(1005, DATE '2026-11-09', 3000, 'cancelled'),
(1006, DATE '2026-11-10', 999, 'placed')
) AS t(order_id, ordered_on, amount_inr, status)
""")
duckdb.sql("""
SELECT
count(*) AS orders,
sum(amount_inr) AS all_orders_inr,
sum(amount_inr) FILTER (WHERE status <> 'cancelled') AS revenue_inr
FROM orders
WHERE ordered_on = DATE '2026-11-09'
""").show()The output looks something like this (the layout varies by version):
┌────────┬────────────────┬─────────────┐
│ orders │ all_orders_inr │ revenue_inr │
├────────┼────────────────┼─────────────┤
│ 5 │ 7950 │ 4150 │
└────────┴────────────────┴─────────────┘Look for two things. all_orders_inr is marketing’s number and revenue_inr is finance’s: the gap is exactly the two cancelled orders. And order 1006 is missing from both, because the date filter decides which day it belongs to. Change its date to 2026-11-09 and predict both totals before you run it again.
Where this shows up
- Design: a first analytics pipeline for an online store builds this nightly pipeline end to end.
- Design: orchestrating a daily reporting pipeline schedules it so the report is ready by 07:00.
- Design: a quality system for finance reports grows the row-count check into a full set of checks.
Meera’s pipeline now exists, but it skips a question: what happens to the data at each stage, from the moment a customer taps “Buy” to the moment Daniel reads a number? That is the next lesson.
Common mistakes
Kafka, Spark and a cloud warehouse are answers to specific problems: data too fresh, too big or too shared for simpler tools. At Kartly’s size, a nightly job and one analytical database do the work. The modern data stack maps the tools once you know what each one is for.
A job that exits cleanly can still load half a day. Check what was loaded against the source before anyone reads it.
If revenue is defined in five dashboards, it will soon have five values. Define it once, in the pipeline, and have every report read that table.
Check your understanding
Kartly’s product team wants to know how many people searched for “phone” yesterday. Which data does Meera’s pipeline need, and roughly how big is it?Show answer
The load job finished at 03:30 with no errors, but the report shows 40% fewer orders than usual. What do you check first?Show answer
Kartly launches a live dashboard for a festival sale that must be under a minute behind. Does the nightly pipeline work for it?Show answer
A new store gets 200 orders a day and has one analyst. Should it build a nightly pipeline first?Show answer
Summary
- Data engineering turns the data apps produce into numbers that are correct, on time and affordable, and a data pipeline is the system that does it.
- The store’s database is built for one order at a time; scanning days of data there, or on a replica, slows the store, gets cancelled, or gives each team its own answer.
- A nightly pipeline copies the data to a separate analytical store, defines each number once, checks it against the source, and runs on a schedule.
- Size the data before choosing tools: at Kartly, orders are about 12 MB a day and click events about 3 GB, so one machine is enough for now.
- Pipelines fail quietly, so a check that compares what was loaded with the source matters as much as the copy.
