spark-python-data-source

Build custom Spark Python data sources for batch and streaming external systems.

1|1|Updated Oct 1, 2025
One-click install
npx skills add https://github.com/mkgs-databricks-demos/synthea-on-fhir --skill spark-python-data-source-mkgs-databricks-demos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spark-python-data-source
Source: https://github.com/mkgs-databricks-demos/synthea-on-fhir/tree/main/.cursor/skills/spark-python-data-source
Command: npx skills add https://github.com/mkgs-databricks-demos/synthea-on-fhir --skill spark-python-data-source-mkgs-databricks-demos

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Building custom Spark data sources can be complex and error-prone, requiring boilerplate code to connect, read, and write to external systems. This Skill provides guidance to implement batch and streaming readers/writers and data source plugins for systems without native Spark support.

Core Features & Use Cases

  • Enables end-to-end Spark data sources in Python, including DataSource, Reader/Writer, and Stream variants.
  • Supports batch and streaming reads/writes to external databases, APIs, and message queues.
  • Real-world use case: connect a REST API as a Spark source to ingest streaming event data into Spark for analytics.

Quick Start

Create a new Spark data source project in Python, implement the DataSource class, and register it with Spark to connect to an external system.

Frequently Asked Questions about spark-python-data-source

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a custom Spark data source in Python for an external system?

To create a custom Spark data source in Python, implement the DataSource class along with Reader/Writer and Stream variants following the PySpark DataSource API. This approach enables reading from and writing to external systems like databases and APIs.

Can I use PySpark DataSource API for both batch and streaming workloads?

Yes, the PySpark DataSource API supports both batch and streaming scenarios. You can implement custom readers and writers to ingest streaming event data or perform batch reads and writes to external message queues and REST APIs.

What is the best way to connect a REST API to Spark for streaming event data?

The best way to connect a REST API to Spark is to build a custom Python data source plugin. By implementing the DataSource and Stream classes, you can ingest streaming event data from the API directly into Spark for analytics.

Do I need a Spark connector for systems without native Spark support?

Yes, for systems lacking native Spark support, you need a custom data source plugin. This Skill guides you through building a flat, dependency-light architecture using the PySpark DataSource API to connect and interact with these external systems.

How does the flat, dependency-light architecture work for Spark data sources?

A flat, dependency-light architecture for Spark data sources relies on implementing DataSource, Reader/Writer, and Stream variants directly in Python. This minimizes external dependencies while enabling batch and streaming data exchange with external systems.