📖 Scenario: You are managing data workflows using Apache Airflow. Some pipelines handle sensitive data and must be protected from unauthorized access. You want to understand how access control helps keep these pipelines safe.
🎯 Goal: Build a simple example showing how to define a list of pipelines, set an access control list (ACL) for users, filter pipelines based on user permissions, and display only the pipelines a user can access.
📋 What You'll Learn
Create a dictionary called pipelines with exact pipeline names and descriptions
Create a list called user_acl containing exact pipeline names the user can access
Use a dictionary comprehension called accessible_pipelines to filter pipelines by user_acl
Print the accessible_pipelines dictionary to show pipelines the user is allowed to see
💡 Why This Matters
🌍 Real World
In real companies, sensitive data pipelines must be protected so only authorized users can see or run them. Access control helps prevent data leaks and mistakes.
💼 Career
Understanding access control is key for DevOps and data engineers managing workflow tools like Airflow to keep data safe and comply with regulations.
Progress0 / 4 steps
1
Create the pipelines dictionary
Create a dictionary called pipelines with these exact entries: 'daily_sales': 'Process daily sales data', 'user_activity': 'Analyze user activity logs', 'payment_processing': 'Handle payment transactions', 'email_campaign': 'Manage email marketing campaigns'
Apache Airflow
Hint
Use curly braces {} to create a dictionary with the exact keys and values given.
2
Define the user access control list
Create a list called user_acl containing these exact pipeline names: 'daily_sales' and 'payment_processing'
Apache Airflow
Hint
Use square brackets [] to create a list with the exact pipeline names given.
3
Filter pipelines by user access
Use a dictionary comprehension called accessible_pipelines to include only the pipelines from pipelines whose keys are in the user_acl list
Apache Airflow
Hint
Use {key: desc for key, desc in pipelines.items() if key in user_acl} to filter the dictionary.
4
Display accessible pipelines
Write a print statement to display the accessible_pipelines dictionary
Apache Airflow
Hint
Use print(accessible_pipelines) to show the filtered pipelines.
Practice
(1/5)
1. Why is access control important in Apache Airflow pipelines?
easy
A. It allows anyone to edit pipelines without restrictions.
B. It speeds up the execution of pipelines automatically.
C. It prevents unauthorized users from changing or viewing sensitive workflows.
D. It deletes old pipeline logs to save space.
Solution
Step 1: Understand the purpose of access control
Access control limits who can see or change pipelines, protecting sensitive data.
Step 2: Identify the correct benefit
Preventing unauthorized changes keeps pipelines safe and reliable.
Final Answer:
It prevents unauthorized users from changing or viewing sensitive workflows. -> Option C
Quick Check:
Access control protects pipelines = A [OK]
Hint: Access control means only allowed users can change pipelines [OK]
Common Mistakes:
Thinking access control speeds up pipelines
Believing anyone can edit pipelines safely
Confusing access control with log management
2. Which Airflow role should be assigned to users who only need to view pipelines but not edit them?
easy
A. Viewer
B. Admin
C. Operator
D. Developer
Solution
Step 1: Review Airflow role definitions
The Viewer role allows users to see pipelines without editing rights.
Step 2: Match role to permission needs
Users who only need to view should not have Admin or Developer roles.
Final Answer:
Viewer -> Option A
Quick Check:
View-only role = Viewer [OK]
Hint: Viewer role means read-only access to pipelines [OK]
Common Mistakes:
Assigning Admin role to view-only users
Confusing Operator with Viewer
Thinking Developer role is for viewing only
3. Given this Airflow access control snippet, what will happen if a user without Admin role tries to edit a pipeline?