📖 Scenario: You work at a company that collects lots of data from different sources like sales, customer feedback, and website logs. You want to organize this data in a Hadoop data lake so it is easy to find and use later.
🎯 Goal: Build a simple data lake structure using Hadoop folders and files that follow common design patterns: raw data, cleaned data, and aggregated data.
📋 What You'll Learn
Create a dictionary called data_lake with keys for raw, cleaned, and aggregated data folders
Add a configuration variable called file_format set to parquet
Use a dictionary comprehension to create file paths for each data type using the file_format
Print the final data_lake_paths dictionary showing the full paths
💡 Why This Matters
🌍 Real World
Data lakes store large amounts of raw and processed data in Hadoop systems. Organizing data with clear folder and file naming helps teams find and use data efficiently.
💼 Career
Understanding data lake design patterns is important for data engineers and analysts working with big data platforms like Hadoop.
Progress0 / 4 steps
1
Create the initial data lake structure
Create a dictionary called data_lake with these exact keys and values: 'raw': '/data/raw', 'cleaned': '/data/cleaned', and 'aggregated': '/data/aggregated'.
Hadoop
Hint
Use curly braces {} to create a dictionary with the specified keys and values.
2
Add a file format configuration
Create a variable called file_format and set it to the string 'parquet'.
Hadoop
Hint
Use a simple assignment statement to create the variable file_format.
3
Create file paths using dictionary comprehension
Use a dictionary comprehension to create a new dictionary called data_lake_paths. For each key and path in data_lake.items(), create a new path by adding a slash and the file name data. plus the file_format extension. For example, the raw path should be /data/raw/data.parquet.
Hadoop
Hint
Use {key: value for key, value in dictionary.items()} and f-strings to build the new paths.
4
Print the final data lake paths
Write a print statement to display the data_lake_paths dictionary.
Hadoop
Hint
Use print(data_lake_paths) to show the dictionary.
Practice
(1/5)
1. What is the main purpose of organizing data into zones like raw, processed, and curated in a data lake?
easy
A. To increase the size of the data lake
B. To keep data clean, easy to find, and ready for analysis
C. To make data harder to access
D. To reduce the number of users accessing data
Solution
Step 1: Understand the role of data zones
Raw, processed, and curated zones help organize data by its state and quality.
Step 2: Identify the benefit of this organization
This organization keeps data clean, easy to find, and ready for analysis.
Final Answer:
To keep data clean, easy to find, and ready for analysis -> Option B
Quick Check:
Data zones improve data usability = A [OK]
Hint: Think about why clean data helps analysis fast [OK]
Common Mistakes:
Confusing size increase with organization benefits
Assuming data zones restrict access
Thinking zones reduce user numbers
2. Which of the following is the correct way to represent the 'raw' data zone in Hadoop folder structure?
easy
A. /data/curated/
B. /data/processed/
C. /data/raw/
D. /data/analytics/
Solution
Step 1: Recall standard folder naming for data zones
The raw data zone is usually stored in a folder named 'raw' to indicate unprocessed data.
Step 2: Match folder names to zones
/data/raw/ matches the raw data zone, while others represent different zones or purposes.
Final Answer:
/data/raw/ -> Option C
Quick Check:
Raw data folder = /data/raw/ [OK]
Hint: Raw data folder always named 'raw' [OK]
Common Mistakes:
Choosing processed or curated folder names for raw data
Which file would most likely contain cleaned and transformed sales data ready for analysis?
medium
A. /data/processed/sales_clean.csv
B. /data/raw/sales_summary.csv
C. /data/curated/sales_summary.csv
D. /data/raw/sales.csv
Solution
Step 1: Understand the meaning of each zone
Raw zone has original data, processed zone has cleaned/transformed data, curated zone has aggregated or summarized data.
Step 2: Identify the file with cleaned and transformed data
/data/processed/sales_clean.csv indicates cleaned sales data ready for further use.
Final Answer:
/data/processed/sales_clean.csv -> Option A
Quick Check:
Processed zone = cleaned data = D [OK]
Hint: Processed folder means cleaned and transformed data [OK]
Common Mistakes:
Choosing raw data file as cleaned data
Confusing curated summary with cleaned data
Selecting non-existent file paths
4. You have a data lake with folders: /data/raw/, /data/processed/, and /data/curated/. You accidentally saved uncleaned data in /data/curated/. What is the best fix?
medium
A. Move the uncleaned data to /data/raw/ and reprocess it
B. Leave the data as is in /data/curated/
C. Delete the /data/raw/ folder
D. Rename /data/curated/ to /data/raw/
Solution
Step 1: Identify the problem with data placement
Uncleaned data should not be in the curated zone, which is for clean, ready data.
Step 2: Choose the correct fix
Moving uncleaned data back to raw zone and reprocessing it ensures proper data flow and quality.
Final Answer:
Move the uncleaned data to /data/raw/ and reprocess it -> Option A
Quick Check:
Raw zone = uncleaned data fix = B [OK]
Hint: Unclean data belongs in raw zone, not curated [OK]
Common Mistakes:
Ignoring data quality rules
Deleting unrelated folders
Renaming folders without moving data
5. You want to design a data lake in Hadoop that supports fast analytics and easy data governance. Which design pattern should you follow?
hard
A. Store all data in a single folder without zones
B. Keep only raw data and process it on-demand
C. Use random folder names for each data type
D. Organize data into raw, processed, and curated zones with clear folder structures
Solution
Step 1: Understand the goal of fast analytics and governance
Fast analytics needs clean, organized data; governance needs clear structure and control.
Step 2: Identify the best design pattern
Organizing data into raw, processed, and curated zones with clear folders supports both goals effectively.
Final Answer:
Organize data into raw, processed, and curated zones with clear folder structures -> Option D
Quick Check:
Zones + clear folders = fast analytics + governance = C [OK]
Hint: Zones and clear folders improve analytics and governance [OK]
Common Mistakes:
Storing all data together causing confusion
Processing data only on-demand slowing queries
Using unclear folder names causing management issues
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.