Where do a million sales go?
A shop chain has 200 shops. Every till (the machine where you pay) sends a sale every few seconds. Cameras record video. Customers send emails.
By the end of the day there are millions of records. The files have many shapes. Where do they all go? And how does the marketing team find what it needs?
Key words
| Word | What it means | Example |
|---|---|---|
| Big data | Data too large, fast or mixed for a normal spreadsheet. | Millions of sales a day |
| Data lake | A store that keeps raw data in any format. | Till logs, videos, emails |
| Data warehouse | A store of cleaned data in one agreed shape, for reports. | A table of all sales |
| Data mart | A small slice of a data warehouse for one team. | Sales for marketing |
| Drawback | A bad point of something. | A lake can become a mess |
| Raw data | Data kept as it arrived. | A till log |
| Cleaned data | Data with mistakes and repeats removed, in one shape. | A tidy table |
| Structured data | Data in rows and columns with set types. | A sales table |
| Unstructured data | Data with no set rows and columns. | A camera video |
The cells students fill in are left blank in this preview.
How the data moves
flowchart LR
tills[Tills] --> lake[(Data lake: raw)]
cameras[Cameras] --> lake
emails[Emails] --> lake
lake -->|clean and organise| wh[(Data warehouse: cleaned)]
wh --> m1[Data mart: marketing]
wh --> m2[Data mart: finance]
Quick check: raw or cleaned?
Have a go
Quick check: raw or cleaned?
4 questionsThe data lake: keep everything
A data lake stores data as it arrives. Video, emails, logs and tables all go in. Nobody cleans it first.
It is cheap and flexible: it takes any kind of data. You can decide later what to do with the data. The drawback: a lake with no care becomes a mess. People cannot find or trust what is inside.
The data warehouse: clean and ready
A data warehouse holds cleaned data in one agreed shape. All sales sit in the same table with the same columns.
Reports run fast and give the same answer to everybody. The drawback: it takes time and skill to clean and load the data. It is also less flexible than a lake.
The data mart: a slice for one team
A data mart is a small part of a warehouse. It holds only what one team needs, such as marketing.
It is small, quick and simple to use. The drawback: the copies can stop matching. The finance team and the marketing team may see different numbers.
Match the store to its description
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
The three stores side by side
| Store | Holds | Who uses it | Benefit | Drawback |
|---|---|---|---|---|
| Data lake | Raw data of any kind | Data scientists | Cheap and flexible | Messy. Hard to trust. |
| Data warehouse | Cleaned, structured data | Analysts and managers | Fast, agreed answers | Costs a lot to clean and load |
| Data mart | A slice of the warehouse | One team | Small and quick | Copies may differ |
The cells students fill in are left blank in this preview.
Worked example: how much data?
| Step | Working | Answer |
|---|---|---|
| Sales in one shop in one day | Given | 5000 |
| Sales in 200 shops in one day | 200 x 5000 (200 times 5000) | 1,000,000 |
| An easy way to do it | 2 x 5 = 10. Then add 5 zeros: 2 from 200 and 3 from 5000 | 10 and 5 zeros = 1,000,000 |
| Sales in 200 shops in one year | 1,000,000 x 365 (1,000,000 times 365) | 365,000,000 |
The cells students fill in are left blank in this preview.
Try it: sort files into stores
files = ["till_7.log", "clean_sales.csv", "mart_marketing.csv", "camera_3.mp4"]
for name in files:
if name.find("clean_") == 0: # find gives 0: the name starts with it
print(name, "-> data warehouse")
elif name.find("mart_") == 0:
print(name, "-> data mart")
else:
print(name, "-> data lake")
# Add a file called clean_stock.csv to the list and run it again.
Make a free account to save your work and track your progress.
Your turn: sort the files
A shop chain names its files so you can tell where they belong. Raw files go in the data lake. Files starting with clean_ go in the data warehouse. Files starting with mart_ go in a data mart. Write three functions. Press Run Tests to check your work.
def where_does_it_go(filename):
# A shop chain keeps files in three places.
# "data lake" raw files, as they arrive (for example till_7.log)
# "data warehouse" cleaned files, whose names start with "clean_"
# "data mart" a slice for one team, whose names start with "mart_"
# Give back the name of the place for this file name.
# Hint: filename.find("clean_") gives 0 when the name starts with clean_
return ""
def sort_files(names):
# Give back a dictionary with the three places as keys.
# Each value is the list of file names that belong there, in the order given.
return {}
def count_raw(names):
# How many of the files are raw (they belong in the data lake)?
return -1
Make a free account to save your work, or press Start lab to work through the whole lesson.
Key words crossword
Have a go
Loading…
Your answers are marked here and are not kept. A college account keeps every student’s marks.
Final check
Have a go
Final check
5 questionsRemember
Tip
Lake: raw and flexible. Warehouse: cleaned and agreed. Mart: a slice for one team. Data usually moves from the lake to the warehouse to the marts.