PySpark is the Python API for Apache Spark distributed data processing. In an Iceberg lakehouse pipeline, it provides the executable layer that reads PostgreSQL data and writes Iceberg tables to object storage. section 3.3.2 section 3.3.3
A practical PySpark setup connects:
- A Spark session, the entry point for DataFrame operations. section 3.3.3
- Project Nessie as the versioned Iceberg catalog. section 3.3.3
- MinIO as S3-compatible object storage for the warehouse. section 3.3.2 section 3.3.3
Starting an Iceberg ingestion session
Define the Nessie catalog URI, S3 warehouse path, and MinIO storage address; configure Spark packages and extensions; then create a SparkSession with spark.jars.packages and SparkSession.builder. section 3.3.3
import pyspark from pyspark.sql import SparkSession #1 ## DEFINE VARIABLES #2 CATALOG_URI = "http://nessie:19120/api/v1" WAREHOUSE = "s3://warehouse/" STORAGE_URI = "http://<minio_ip>:9000"
Use the compact initialization listing to inspect the imports and connection variables required before configuring the Spark session. section 3.3.3
