PySpark ETL pipelines
Builds PySpark ETL jobs with Spark SQL and Iceberg idioms, so pipelines run fast and rerun safely.
Claude's review
7/10 Practical PySpark and Iceberg idioms with clear do and don't rules and snippets.
We asked Claude the question you would ask: would I be glad I installed this? We only sell skills it rates 7 or higher.
In detail
Best practices for building performant, testable PySpark ETL pipelines with Spark SQL and Apache Iceberg. Use when writing or reviewing PySpark jobs, designing joins and window functions, working with map/array higher-order functions, or building idempotent cumulative/snapshot table merges.
How you use it
- Add it to your pack, then download your pack (1 credit).
- In Claude, open Customize > Skills and upload the zip. Code execution needs to be on under Settings > Capabilities.
- Ask Claude for the job in your own words. It uses the skill when your request matches what it does. Step by step guide
Safety check
Nothing risky found: no hidden instructions, no download and run, no reading of saved passwords or keys.
An automated scan lowers risk but cannot promise zero risk. How we check skills
Preview
The first lines of SKILL.md
---
name: pyspark-etl
description: "Best practices for building performant, testable PySpark ETL pipelines with Spark SQL and Apache Iceberg. Use when writing or reviewing PySpark jobs, designing joins and window functions, working with map/array higher-order functions, or building idempotent cumulative/snapshot table merges."
metadata:
maintainer: Mindrally
source: https://github.com/Mindrally/skills
---
# PySpark ETL
This skill covers patterns for building production-grade, testable ETL pipelines with PySpark, Spark SQL, and Apache Iceberg, including project structure, join and window-function idioms, and safe cumulative-table merge patterns.
## Workflow for Building a PySpark ETL Job
1. **Scaffold the job class** — Create a class that manages the `SparkSession` lifecycle, accepts an injectable session for testing, and exposes an abstract `run_job` method.
2. **Define config via a factory function** — Keep config as a plain dataclass; parse CLI args in a separate factory function so tests can construct configs without touching `sys.argv`.
3. **Read source data with a shared, partition-aware reader** — Use a generic reader utility for date filters, hour ranges, and latest-partition lookups; keep business filters in the ETL class.
4. **Compose the pipeline with `.transform()`** — Chain named methods (`read_source().transform(self.enrich).transform(self.merge_with_existing)`) so `run_job` stays pure orchestration.
5. **Apply transformations idiomatically** — Use `select` over `withColumn` chains, explicit join types, explicit window frames, and native functions instead of UDFs.
6. **Write with schema-evolution safety** — Use `.byName()` when writing to Iceberg tables so column order doesn't matter.
7. **Validate output** — Check primary-key uniqueness and null counts on key columns after every write.
8. **Test locally** — Unit test transformation methods against a local `SparkSession` with small, hand-built DataFrames.
## Project Structure
### ETL class scaffold
```python
from abc import ABC, abstractmethod
import logging
from pyspark.sql import SparkSession
class BaseETL(ABC):
def __init__(self, config, app_name="ETL Job", spark_session=None):
self.spark = spark_session or SparkSession.builder.appName(app_name).getOrCreate()
self.config = config
self.logger = logging.getLogger(self.__class__.__name__)
@abstractmethod
def run_job(self): ...
...From Mindrally's repository, Apache-2.0 licence.
Related skills
-
Checked
Dashboard design
Designs clean, honest dashboards for web and SwiftUI with KPI cards, charts and layouts that work on phones.
7/101 credit -
Checked
User path analysis
Analyses event logs with Retentioneering to map user paths, funnels and churn, and shows where users drop off.
7/101 credit -
Checked
Geospatial SQL builder
Writes cost safe geospatial SQL for BigQuery, DuckDB, Snowflake and Postgres, with optional maps in Dekart.
7/101 credit -
Checked
Snowflake SQL and Cortex
Writes Snowflake SQL, Dynamic Tables, Streams, Cortex AI and Snowpark code while dodging common errors.
7/101 credit -
Checked
dbt platform migration
Moves a dbt project from one warehouse to another and fixes SQL dialect gaps, so your models build again.
7/101 credit -
Checked
CSV and Excel merging
Merges, stacks and dedupes CSV and Excel files into one clean table, then checks the row counts add up.
7/101 credit