python-data-pipelines
Skill2 starsChanged 10 months agoMITView on GitHub
Data pipeline orchestration with Prefect and Airflow. Use this skill when building ETL/ELT pipelines, need to choose orchestration tools, or designing data workflows. Covers task dependencies, error handling, retries, scheduling, and best practices for data pipeline architecture.
In this repository38 other files it gives its agents.
- Data Engineering Cloud InfrastructureSkill
- data-eng-data-qualitySkill
- data-eng-streaming-patternsSkill
- data-eng-testing-patternsSkill
- data-eng-warehouse-patternsSkill
- DevOps CI/CD PatternsSkill
- devops-docker-patternsSkill
- devops-monitoring-observabilitySkill
- devops-terraform-patternsSkill
- git-advanced-operationsSkill
- git-workflow-patternsSkill
- modern-python-patternsSkill
- python-api-developmentSkill
- python-async-patternsSkill
- python-data-wranglingSkill
- python-devops-automationSkill
- python-error-handlingSkill
- python-package-developmentSkill
- python-performanceSkill
- python-testingSkill
- customizing-vectors-rSkill
- designing-oop-rSkill
- developing-packages-rSkill
- metaprogramming-rlangSkill
- optimizing-rSkill
- writing-tidyverse-rSkill
- sql-advanced-featuresSkill
- sql-analytics-patternsSkill
- sql-data-modelingSkill
- SQL Integration PatternsSkill
- sql-query-fundamentalsSkill
- sql-query-optimizationSkill
- sql-transformationsSkill
- API DesignSkill
- webdev-html-css-patternsSkill
- webdev-javascript-fundamentalsSkill
- webdev-react-patternsSkill
- webdev-typescript-patternsSkill
The file
Files
Python Data Pipelines
Modern data pipeline orchestration patterns with Prefect and Airflow.
Decision Matrix: Prefect vs Airflow
| Factor | Prefect | Airflow | Winner |
| Learning curve | Gentler (Pythonic) | Steeper (DAG syntax) | Prefect |
| Dynamic workflows | Native | Requires workarounds | Prefect |
| Local development | Excellent | Harder | Prefect |
| Ecosystem maturity | Newer (2018) | Mature (2014) | Airflow |
General guidance:
- Use Prefect when: New projects, want Pythonic API, dynamic workflows
- Use Airflow when: Existing Airflow org, need battle-tested tool
Prefect Patterns
Basic Task and Flow
from prefect import task, flow
@task
def extract_data(source: str) -> list:
return fetch_from_api(source)
@task
def transform_data(data: list) -> list:
return [process_record(r) for r in data]
@flow(name="ETL Pipeline")
def etl_pipeline(source: str, destination: str):
raw = extract_data(source)
transformed = transform_data(raw)
load_data(transformed, destination)Retries and Caching
from datetime import timedelta
from prefect.tasks import task_input_hash
@task(
retries=3,
retry_delay_seconds=60,
cache_key_fn=task_input_hash,
cache_expiration=timedelta(hours=1)
)
def unreliable_api_call(endpoint: str):
response = requests.get(endpoint)
response.raise_for_status()
return response.json()See prefect-patterns.md for:
- Subflows
- Task results and artifacts
- Scheduling and deployment
Airflow Patterns
Basic DAG
from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime, timedelta
with DAG(
'etl_pipeline',
schedule_interval='@daily',
start_date=datetime(2024, 1, 1),
catchup=False
) as dag:
extract >> transform >> loadSee airflow-patterns.md for:
- TaskFlow API (modern Airflow)
- Sensors for waiting
- Branch operators
- Dynamic task generation
Pipeline Design Best Practices
Idempotency
# GOOD - Upsert based on key
def load_data(data):
for record in data:
db.upsert(record, key='id')Incremental Processing
@task
def extract_incremental(last_run: datetime):
return fetch_data_since(last_run)Data Quality Checks
@task
def validate_data(data: list) -> list:
for record in data:
assert 'id' in record, "Missing ID"
assert record['amount'] >= 0, "Negative amount"
return dataSee pipeline-design-patterns.md for:
- Partitioning strategies
- Backfill patterns
- Monitoring and alerting
Testing Pipelines
See testing-pipelines.md for:
- Mocking data sources
- Integration test patterns
- Local development setups
Anti-Patterns to Avoid
| Avoid | Use Instead |
| Non-idempotent operations | Upserts, delete-and-insert |
| Tightly coupled tasks | Clear interfaces |
| No error handling | Retries, alerts, checkpoints |
source: Prefect docs, Airflow docs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

