| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
A complete ETL (Extract, Transform, Load) pipeline demonstrating data processing workflows on Render.
Process customer signup data from CSV files with validation, cleaning, and statistical analysis. This pattern is common for:
run_etl_pipeline (main orchestrator) ├── extract_csv_data (reads CSV file) ├── transform_batch (validates all records) │ └── validate_record (called for each record) └── compute_statistics (aggregates results)
# Navigate to example directory
cd etl-job
# Install dependencies
pip install -r requirements.txt
# Run the workflow service
python main.pyService Type: Workflow
Build Command:
cd etl-job && pip install -r requirements.txtStart Command:
cd etl-job && python main.pyRequired:
Create Workflow Service
Configure Build Settings
Set Environment Variables
Deploy
Once deployed, you can test tasks directly in the Render Dashboard without writing any code:
Important: The ETL pipeline expects a simple string input (the file path), not a JSON object.
Recommended Starting Point: Start with run_etl_pipeline - this is the main orchestrator task that demonstrates the complete ETL workflow (extract → transform → load).
Test the main ETL pipeline:
Task: run_etl_pipeline
Input:
"sample_data.csv"Note: The Render Dashboard will show you the task execution status, logs, and results in real-time.
Once deployed, trigger the ETL pipeline via the Render API or SDK:
from render import Render
# Uses RENDER_API_KEY environment variable automatically
render = Render()
# Run the ETL pipeline
task_run = await render.workflows.run_task(
"etl-job-workflows/run_etl_pipeline",
{"source_file": "sample_data.csv"}
)
# Wait for completion
result = await task_run
print(f"Pipeline status: {result.results['status']}")
print(f"Valid records: {result.results['transform']['valid_count']}")The example includes sample_data.csv with test data containing:
This demonstrates how the pipeline handles data quality issues.
extract_csv_data: Reads CSV file and returns records as list of dictionaries. Includes retry logic for file system issues.
validate_record: Validates a single record:
transform_batch: Processes all records by running validate_record as a subtask for each one:
for record in records:
# Run validate_record as a subtask on its own compute
validated = await ctx.run(validate_record, record)This demonstrates running subtasks in a loop for batch processing.
compute_statistics: Aggregates valid records to produce:
run_etl_pipeline: Main orchestrator that runs three subtasks sequentially:
This demonstrates sequential subtask orchestration for multi-stage pipelines.
Add Database Loading:
@app.task
async def load_to_database(ctx: TaskContext, records: list[dict]) -> dict:
# Connect to database
# Insert records
# Return confirmation
passAdd API Data Source:
@app.task
async def extract_from_api(ctx: TaskContext, api_url: str) -> list[dict]:
# Fetch from REST API
# Parse JSON response
# Return records
passAdd Parallel Processing:
import asyncio
@app.task
async def transform_batch_parallel(ctx: TaskContext, records: list[dict]) -> dict:
# Validate all records in parallel
tasks = [ctx.run(validate_record, record) for record in records]
results = await asyncio.gather(*tasks)
# Aggregate results
return results| Back | FazBrowse Home | New Git URL |